Skip to main content
Question

Problem with AttributeFileWriter


scarter
Contributor
Forum|alt.badge.img+10

I'm trialling AttributeFileWriter to output a list of values from a table from a specified attribute field. In theory AttributeFileWriter seems to be ideal for the task.

 

I've read in the source data which has 13 records. I want to create a .txt list of all the application numbers from the 'application_number' field.

 

There are no duplicate application numbers in the source data so I'd expect an output of 13 applications numbers in the .txt.

 

In AttributeFileWriter I've set the Source Attribute to application_number. But when I view the output .txt only one application numbers is listed, and not 13 as expected.

 

Any ideas as to why this is?

4 replies

david_r
Celebrity
  • June 2, 2021

Is the AttributeFileWriter configured for appending or replacing content?

Also, why not use a FeatureWriter with the Text File writer? https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_ReadersWriters/textline/TEXTLINE_writer.htm


scarter
Contributor
Forum|alt.badge.img+10
  • Author
  • Contributor
  • June 2, 2021
david_r wrote:

Is the AttributeFileWriter configured for appending or replacing content?

Also, why not use a FeatureWriter with the Text File writer? https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_ReadersWriters/textline/TEXTLINE_writer.htm

Thanks for that, david_r. I switched to ‘Append to file’ and it now produces all 13 values. Great. Is there a way of adding a delimiter to the outputted values? Or is there a way of outputting as a list? So instead of… value_1 value_2 value_3 value_4 value_5 value_6 value_7 value_8 value_9 value_10 value_11 value_12 value_13 I would get… value_1; value_2; value_3; value_4; value_5; value_6; value_7; value_8; value_9; value_10; value_11; value_12; value_13 or to get… value_1 value_2 value_3 value_4 value_5 value_6 value_7 value_8 value_9 value_10 value_11 value_12 value_13 Thanks, value_1 value_2 value_3 value_4 value_5 value_6 value_7 value_8 value_9 value_10 value_11 value_12 value_13

david_r
Celebrity
  • June 2, 2021
scarter wrote:
Thanks for that, david_r. I switched to ‘Append to file’ and it now produces all 13 values. Great. Is there a way of adding a delimiter to the outputted values? Or is there a way of outputting as a list? So instead of… value_1 value_2 value_3 value_4 value_5 value_6 value_7 value_8 value_9 value_10 value_11 value_12 value_13 I would get… value_1; value_2; value_3; value_4; value_5; value_6; value_7; value_8; value_9; value_10; value_11; value_12; value_13 or to get… value_1 value_2 value_3 value_4 value_5 value_6 value_7 value_8 value_9 value_10 value_11 value_12 value_13 Thanks, value_1 value_2 value_3 value_4 value_5 value_6 value_7 value_8 value_9 value_10 value_11 value_12 value_13

My recommendation is to replace the AttributeFileWriter (which is a specialty one-trick-pony transformer) with the much more powerful FeatureWriter. Specifically, look into using either the Text File or the CSV writer.

The AttributeFileWriter is not really meant for what you're trying to accomplish.


scarter
Contributor
Forum|alt.badge.img+10
  • Author
  • Contributor
  • June 2, 2021
scarter wrote:
Thanks for that, david_r. I switched to ‘Append to file’ and it now produces all 13 values. Great. Is there a way of adding a delimiter to the outputted values? Or is there a way of outputting as a list? So instead of… value_1 value_2 value_3 value_4 value_5 value_6 value_7 value_8 value_9 value_10 value_11 value_12 value_13 I would get… value_1; value_2; value_3; value_4; value_5; value_6; value_7; value_8; value_9; value_10; value_11; value_12; value_13 or to get… value_1 value_2 value_3 value_4 value_5 value_6 value_7 value_8 value_9 value_10 value_11 value_12 value_13 Thanks, value_1 value_2 value_3 value_4 value_5 value_6 value_7 value_8 value_9 value_10 value_11 value_12 value_13
OK, thanks. That works much better.

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings