Skip to main content

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

 

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.


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


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.


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

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


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