Solved

How to configure TXT structure

  • 24 October 2019
  • 6 replies
  • 2 views

Badge +1

Hello to all FME fans,

I have met one issue, how to configure transformers/writers for TXT with constant/dynamic content.

E.g. I just wanna generate TXT report with found errors, like below:

*TOPOLOGY ERRORS

FEATURE CLASS | OPACITY | ERROR | COUNT

--------------------------------------------------------------------------------

Value(FT) | Value(O) | Valu(E) | 10

--------------------------------------------------------------------------------

 

Please, as You can see, there mix of constant/dynamic (attribute) items.

How can I define to constant items its firm position (column 32) etc.?

 

Thank You so much!

Lubo

 

icon

Best answer by ebygomm 24 October 2019, 21:22

View original

6 replies

Badge +21

Hi @lazarlubomir

The CAT (Column aligned writer) might help you. However I find it better to use a regular writer and then "parse" the lines according to the standard myself by creating each line "manually" using an Attributecreator. Especially if the style changes through the file - for instance 4 columns in the start, then a header, then a breakline etc.

Userlevel 1
Badge +21

I would use a stringpadder to pad whitespace up to a specific length before creating the text_line_data attribute

 

Might be a bit convoluted if you want to pad different attributes depending on the longest value

Badge +1

Hi @lazarlubomir

The CAT (Column aligned writer) might help you. However I find it better to use a regular writer and then "parse" the lines according to the standard myself by creating each line "manually" using an Attributecreator. Especially if the style changes through the file - for instance 4 columns in the start, then a header, then a breakline etc.

@sigtill,

unfortunately, CAT writer doesnt exist - only reader is available. As You recommend - Yes, it a way what I was thinking about, but I try to find "easier" way, how to do that.

Userlevel 4
Badge +26

Use an StringConcatenator to create single line/attribute with "Value(FT) | Value(O) | Valu(E) | 10 "

 

Use an Aggregator to merge the single line - (you can concatonate with a new line Character)

Then use another StringConcatenator to add the static content at the top and bottom of your Aggregated String.

 

 

Example attached

 

 

none2textline.fmw
Userlevel 1
Badge +21

One possible way of calculating the max length a field would be and using that as the value to pad the figures to make them a consistent length

csv22textline.fmwt

Badge +1

One possible way of calculating the max length a field would be and using that as the value to pad the figures to make them a consistent length

csv22textline.fmwt

@ebygomm,

this is what I exactly need!

Thank You so much!

Reply