Skip to main content
Question

Extracting specific attributes from a data list?

  • September 9, 2019
  • 8 replies
  • 574 views

mda
Contributor
Forum|alt.badge.img+7
  • Contributor

Hi,

@takashi

 

I have a list of data as the attached xls sheet. I need to extract specific attributes which come many times in the list. The list contains attributes with the value [name:(different names)] and under this one there are attributes start with the value (string:......). I need to loop through this list and extract the attribute which has the value (name:USED_DATA) with all attributes underneath it which start with (string:.....). The rest I don't need it. The list contains information about many objects. Each object has index starts with 0. So, each object has attributes which I need to extract. Unfortunately, the attribute with the value (name:USED_DATA) comes with different index (so not regular) and this is why I can't use an existing transformer in FME to do what I need or at least to my knowledge. Could you please guys help me with it. Maybe there is a trick to do so which I couldn't find. Looking forward to hear from you!

Kind Regards,,,

 

8 replies

ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • September 9, 2019

You should be able to use the adjacent feature option in an attributecreator to create groupings


mda
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • September 9, 2019
ebygomm wrote:

You should be able to use the adjacent feature option in an attributecreator to create groupings

Hi,

Thanks for your quick response!

I tried to do what you have suggested. However I don't get a (feature[-1].Group) attribute. I just get the attributes which can be seen in the attachment. Could you please tell me how can I get it.


mda
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • September 9, 2019
ebygomm wrote:

You should be able to use the adjacent feature option in an attributecreator to create groupings

One more thing. I do see the (feature[-1].Group) before I start fill in the if condition with (_extended_data_list) attribute. However, after adjusting the first if condition, the (feature[-1].Group)attribute disappears.


ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • September 9, 2019
mda wrote:

Hi,

Thanks for your quick response!

I tried to do what you have suggested. However I don't get a (feature[-1].Group) attribute. I just get the attributes which can be seen in the attachment. Could you please tell me how can I get it.

If you add another attributecreator in front creating a blank attribute of Group you'll then be able to select it in the second attributecreator. You can create a blank attribute a line up in the existing attributecreator, but fme will tell you you have an invalid transformer but it will work


mda
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • September 9, 2019
ebygomm wrote:

If you add another attributecreator in front creating a blank attribute of Group you'll then be able to select it in the second attributecreator. You can create a blank attribute a line up in the existing attributecreator, but fme will tell you you have an invalid transformer but it will work

Hi @egomm,

 

Now I create grouping for each set of atrributes which have the values of (name:..........., & string:........). There are many name:..... attributes but I just need one of them per every object. This attribute called exactly (name:USER_DATA) and the attributes beneath it which start with (string:.....). and the rest I don't want it. Do you have a tip on how to extract just those attributes I need. In the attached photos, I drew a line around the data I need. This data comes many time in the list and I need to extract it all. Do you have tips to do this. Thanks a lot!


ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • September 9, 2019
mda wrote:

Hi @egomm,

 

Now I create grouping for each set of atrributes which have the values of (name:..........., & string:........). There are many name:..... attributes but I just need one of them per every object. This attribute called exactly (name:USER_DATA) and the attributes beneath it which start with (string:.....). and the rest I don't want it. Do you have a tip on how to extract just those attributes I need. In the attached photos, I drew a line around the data I need. This data comes many time in the list and I need to extract it all. Do you have tips to do this. Thanks a lot!

You could alter your conditional value so that the rows that start with name:USED DATA are treated differently

e.g.

You could then use a tester to get rid of any features with a value of ignore


mda
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • September 9, 2019
ebygomm wrote:

You could alter your conditional value so that the rows that start with name:USED DATA are treated differently

e.g.

You could then use a tester to get rid of any features with a value of ignore

I tried it but it results in the following:

 

So all the values in Group is "ignore". The name:USER_DATA doesn't treated differently.


mda
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • September 9, 2019
mda wrote:

I tried it but it results in the following:

 

So all the values in Group is "ignore". The name:USER_DATA doesn't treated differently.

Dear @egomm,

It is solved now. I used regular expressions in the condition and now it works. Thanks a lot for the tip.


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