Question

How to load text data lines into an attribute?

  • 9 August 2019
  • 2 replies
  • 23 views

Badge

I have a bunch of text files and each files contain one feature different attributes. I want to load the first line data as the first attribute, the second as the second attribute. Could you please give me ahint how to implement it? Here is the process, that I am using:


2 replies

Userlevel 2
Badge +12

So, if each text file is representing one feature, you can use the Aggregator transformer to create a list of all the text lines on the one feature.

Then use the AttributeManager transformer to copy the list elements to the right attribute name, like _list{0} to Attribute1, _list{1} to Attribute2 ........

For more complex situations you can also consider using the SchemaMapper transformer, but that one is harder to grasp.

Hope this helps.

Userlevel 2
Badge +17

Hi @gylona, not clear what the requirement is. Could you please explain more specifically?

If you have these two text files, for example, what result you need?

text1.txt (2 lines)

abc
xyz

text2.txt (3 lines)

111
222
333

If the examples above weren't appropriate to explain your situation, please post better examples.

Reply