Skip to main content
Question

Add sequence number to unknown count attribute split list


fme4fsj
Participant
Forum|alt.badge.img
I have a DBF file that has a list of ID's, seperated by a comma, in a single field.  I also have a field that gives me a count of the number of IDs.  I need to add an attribute that gives each exploded InterimID (see example below) their sequence in the list.  I can split that list, explode it to get each ID and I thought about using an AttributeValueMapper with the _List(0) number, but how do I add a value as a sequence attribute to each exploded ID when the count could be anything?  Am I on the wrongtrack?

 

 

Example:

 

Line_ID     StartID     InterimID             NoInterimID     EndID

 

1234          789          234,543,756               3                 8976

 

 

 

Is this a clear enough example?

6 replies

david_r
Evangelist
  • April 22, 2013
Hi,

 

 

not quite sure I understand what you need here, to be honest. Could you perhaps post an example of what you have (input) and what you desire as output? Also, please specify if which version of FME you're using.

 

 

I guess you have already looked at the AttributeSplitter, ListElementCounter and ListIndexer?

 

 

David

ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • April 22, 2013
If you're using the attribute splitter to create your list, then using a list exploder the _element_index attribute gives the sequence of each exploded ID

fme4fsj
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • April 22, 2013
Thanks for the quick replies.   I had been using FME 2010 but just upgraded to FME2013 still not familiar with all the changes though.  

 

 

I was just thinking I should have put what I wanted as output.  From the  input.:

 

 

Line_ID     StartID     InterimID             NoInterimID     EndID

 

1234          789          234,543,756               3                 8976

 

 

I'd like as output:

 

Line_ID    ID        Sequence

 

1234          789              1            (fromStartID)

 

1234          234               2           (from 1st InterimID)

 

1234          543               3           (from 2nd InterimID)

 

1234          756               4            (from 3rd InterimID)

 

1234         8976              5           (from EndID)

 

 

Does this make things clearer?  I am trying this with the AttributeSplitter and Counter.   I haven't looked at the ListElementCounter and ListIndexer.  I will take a look now..

 

 

Thanks for the pointer.

ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • April 22, 2013

Ok

 

 

I would concatenate start ID, interim ID and End ID to get a new attribue with value

 

 

789,234,543,756,8976

 

 

Attribute splitter  to split that attribute into a list, then a list exploder. The list exploder will add an attribute named _element_index which will give the order of the ID in the sequence (note that the order starts from 0 rather than 1)

mark2atsafe
Safer
Forum|alt.badge.img+44
  • Safer
  • April 22, 2013
I'm with @EGomm on this - concatenate the attributes together (StringConcatenator) split them up (AttributeSplitter) then separate out the list (ListExploder).

fme4fsj
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • April 22, 2013
Thank you all for your quick replies on this especially @EGomm as that seems like such a simple solution.  And I do prefer simplicity.   I'm trying it now. 

Reply


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