Skip to main content

Hi,

My Workspace two Source : 1 feature of line and a Excel file with 3 features.

The goal is bring the attributes of the XLS into a line.

How can you see in my Template file, i used the FeatureMerger and after ListExploder.

I have 3 lines but i need just one with all attributes.

Attached my Workspace.

Thanks,

Danilo

Hi @danilo_inovacao,

Could you use the ListConcatenator (create comma separated values in the attributes) instead of the ListExploder?

The ListExploder will create multiple features (lines) and the ListConcatenator will not.


I agree with @erik_jan, you may want to avoid the ListExploder here.

For some use cases you may not want to concatenate all the suppliers, perhaps you just want one of them. In those cases you could e.g. use a ListSorter to "bubble" your preferred item to the top of the list and then use a ListIndexer to only keep that particular item.

Also a quick tip for the FeatureMerger: you don't have to create a separate join attribute if it's static, you can simply type something into the "Join on" fields, e.g. if usually just type "1" into both for an unconditional merge:


Hi @erik_jan and @david_r thanks to help me.

I removed the ListExploder and used the configuration on FeatureMerger 1:1 how the @david_r wrote.

After like @erik_jan wrote, i use the transformer ListConcatenator and my result is:

Now, how can i turn the attributes like the image bellow?

Thanks,

Danilo


Hi @erik_jan and @david_r thanks to help me.

I removed the ListExploder and used the configuration on FeatureMerger 1:1 how the @david_r wrote.

After like @erik_jan wrote, i use the transformer ListConcatenator and my result is:

Now, how can i turn the attributes like the image bellow?

Thanks,

Danilo

Not sure I understand what you need, how would you like your single line feature to include those three values? Can you give an example?

Use the ListExploder like your original workspace. However, you will have to set "Use List Attribute Values" to the Conflict Resolution parameter, or set "Only Use List Attributes" to the Accumulation Mode parameter..


Not sure I understand what you need, how would you like your single line feature to include those three values? Can you give an example?
Hi @david_r, I'm sorry if i didn't clear.

 

After your tip i have the attributes like a list:

 

How can I deal with this list?

 

Thanks

 

 


Use the ListExploder like your original workspace. However, you will have to set "Use List Attribute Values" to the Conflict Resolution parameter, or set "Only Use List Attributes" to the Accumulation Mode parameter..

 

Your original workspace creates this table.

 

 

 

However, you need to create this one, I think.

 

 

 

If my understanding mentioned above is correct, just modify the parameter setting in the ListExploder like I suggested in my previous post.

Use the ListExploder like your original workspace. However, you will have to set "Use List Attribute Values" to the Conflict Resolution parameter, or set "Only Use List Attributes" to the Accumulation Mode parameter..

Hi @takashi, how can i take the attributes ( listexploder-required-result.png ) and into in just one line?

 

Thanks,

 


Use the ListExploder like your original workspace. However, you will have to set "Use List Attribute Values" to the Conflict Resolution parameter, or set "Only Use List Attributes" to the Accumulation Mode parameter..

I cannot understand what you want. The ListExploder and the ListConcatenator both didn't satisfy your requirement? Can you post a screenshot that illustrates your required result?

 

 


Use the ListExploder like your original workspace. However, you will have to set "Use List Attribute Values" to the Conflict Resolution parameter, or set "Only Use List Attributes" to the Accumulation Mode parameter..

if you want this one, expose the list elements {0} - {2}, then rename them with an AttributeManager.

 

 


Hi @takashi, @TiaAtSafe, @david_r , @erik_jan

I created a image to describe:

Thanks,

Danilo


Hi @takashi, @TiaAtSafe, @david_r , @erik_jan

I created a image to describe:

Thanks,

Danilo

Hi @danilo_inovacao,

 

What you describe here is FME using a list with 3 values for id and name.

 

That means not using the ListExploderat all, just the FeatureMerger.

 


Hi @danilo_inovacao,

 

What you describe here is FME using a list with 3 values for id and name.

 

That means not using the ListExploderat all, just the FeatureMerger.

 

Hi @erik_jan, after the FeatureMerger i will have a list,ok.

 

So after i can do?

 

Thanks,

 


Hi @danilo_inovacao. I thought I'd try your problem as well!

Using a ListBuilder before the FeatureMerger keeps the output features to 1 while retaining all three attributes from the XLS features. The attached workspace results in the following single line feature, where the values 2, 1, 0 represent your city names:

Perhaps this is the result you're looking for? Don't forget that the list attribute output can be manipulated in lots of ways. Check out this series of tutorials for a ton more information on lists in FME.

mergeline-attributes.fmw


Hi @takashi, @TiaAtSafe, @david_r , @erik_jan

I created a image to describe:

0684Q00000ArLl8QAF.png

Thanks,

Danilo

What I got from your image is that the destination feature should have a single line geometry and three pairs of id and name. If so, I would create a single attribute that stores XML or JSON document containing the three pairs of id and name. e.g.

 

XML

 

<table>
    <row>
        <column name="id" value="1" />
        <column name="name" value="vancouver" />
    </row>
    <row>
        <column name="id" value="2" />
        <column name="name" value="london" />
    </row>
    <row>
        <column name="id" value="3" />
        <column name="name" value="lima" />
    </row>
</table>
JSON

 

{
    "attributes" : c
        { "id" : 1, "name" : "vancouver" },
        { "id" : 2, "name" : "london" },
        { "id" : 3, "name" : "lima" }
    ]
}

Hi @danilo_inovacao, I'm afraid that no one can provide any specific solution unless you clarify how the destination feature should store the three pairs of id and name.

We have already suggested these different approaches so far.

  • List: _list{}.id, _list{}.name
  • Concatenated values: e.g. "ids"="1,2,3", "names"="vancouver,london,lima"
  • Individual values: e.g. "id0"="1", "name0"="vancouver", "id1"="2", "name1"="london", "id2" = "3", "name2"="lima"
  • XML
  • JSON

In the items listed above, which is your desired data structure?

If your desired one has not been suggested yet, please explain specifically your requirement.


@danilo_inovacao

Almost.

But do a stringconcatenator first. id <space> nome <NewLine>

Then listbuilder

Then listconcatenator with no separator.

 


Weird...these best answers. None emulate the requested output.

The only solution to actually emulate desired output is to use a stringconcatenator before listbuilding and listconcatenating.

So the attribute looks like a table (albeit without cellborderlines...)


Reply