The additional "header" row is simply the following:
[DATA]
Appreciate your time and any assistance,
Lowell
Best answer by jelle
lmorris2019 wrote:
Hi jelle,
Thanks for the help. The file is small, 19 rows with 4 columns so I am trying to follow your 1st suggestion.
Not sure how to concatenate [DATA] with the attribute containing the CSV file.
I tried the following:But I did not do something quite right as the results look like this:
Thanks again for your time and help.
Lowell
Hi Lowell,
I think it would be better to connect the AttributeFileReader to the Summary Port of the FeatureWriter. You do not need the text reader.
Concatenating the attribute goes as follows:
The FeatureWriter takes care of all the CSV settings. The reason not to pass all the records to the AttributeFileWriter is that you want to read it only once. With the StringConcatenator, you can add your additional line before the CSV as an attribute.
now read the CSV file with AttributeFileReader (read it in the same codepage as the CSV)
Concatenate [DATA] 'Carriage Return' with the attribute containing the CSV file
write as a text file with the extension .csv
I wouldn't recommend this for large CSV files, though.
Another way would be to:
use a FeatureWriter to store the CSV file
Prepare a Textfile writer with the extension .csv in the file name
Connect the Summary port of the FeatureWriter withn a AttributeCreator and create an attribute 'text_line_data' with the value 'DATA'
connect it with the Textfile writer
Connect the Summary port of the FeatureWriter with a FeatureReader
!!Set the Connection Runtime Order' by right-clicking on the connection and make sure that the flow to the Creation of the 'text_line_data' attribute goes first !!
Read the CSV file you created as a text file with a FeatureReader
Connect the output to the TextFile writer
Now, everything should be available in the right order
now read the CSV file with AttributeFileReader (read it in the same codepage as the CSV)
Concatenate [DATA] 'Carriage Return' with the attribute containing the CSV file
write as a text file with the extension .csv
I wouldn't recommend this for large CSV files, though.
Another way would be to:
use a FeatureWriter to store the CSV file
Prepare a Textfile writer with the extension .csv in the file name
Connect the Summary port of the FeatureWriter withn a AttributeCreator and create an attribute 'text_line_data' with the value 'DATA'
connect it with the Textfile writer
Connect the Summary port of the FeatureWriter with a FeatureReader
!!Set the Connection Runtime Order' by right-clicking on the connection and make sure that the flow to the Creation of the 'text_line_data' attribute goes first !!
Read the CSV file you created as a text file with a FeatureReader
Connect the output to the TextFile writer
Now, everything should be available in the right order
Possibly, there are easier ways to do this
Hi jelle,
Thanks for the help. The file is small, 19 rows with 4 columns so I am trying to follow your 1st suggestion.
Not sure how to concatenate [DATA] with the attribute containing the CSV file.
I tried the following:But I did not do something quite right as the results look like this:
Thanks for the help. The file is small, 19 rows with 4 columns so I am trying to follow your 1st suggestion.
Not sure how to concatenate [DATA] with the attribute containing the CSV file.
I tried the following:But I did not do something quite right as the results look like this:
Thanks again for your time and help.
Lowell
Hi Lowell,
I think it would be better to connect the AttributeFileReader to the Summary Port of the FeatureWriter. You do not need the text reader.
Concatenating the attribute goes as follows:
The FeatureWriter takes care of all the CSV settings. The reason not to pass all the records to the AttributeFileWriter is that you want to read it only once. With the StringConcatenator, you can add your additional line before the CSV as an attribute.
Thanks for the help. The file is small, 19 rows with 4 columns so I am trying to follow your 1st suggestion.
Not sure how to concatenate [DATA] with the attribute containing the CSV file.
I tried the following:But I did not do something quite right as the results look like this:
Thanks again for your time and help.
Lowell
Sorry for continuing to be a bother. I have been able to get [DATA] in the text file, but the data is duplicated 18 times.
Below is a sample of the output file. It has 18 sets of the same data. I've tried a number of other things, but either no data is written or [DATA] does not show in the output file.
Thanks for the help. The file is small, 19 rows with 4 columns so I am trying to follow your 1st suggestion.
Not sure how to concatenate [DATA] with the attribute containing the CSV file.
I tried the following:But I did not do something quite right as the results look like this:
Thanks again for your time and help.
Lowell
Attached the AttributeFileReader to the Summary port of FeatureWriter, there should only be one feature come out of that. If not use a sampler to get just the last record.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.