Skip to main content

So as the title says I have an ID field that goes from 1 to 6 and it repeats for the next set of Attributes, I wanted to use this to create an Aggregate field. to bring each set of attributes under their correct fields.

so I should have uploaded this with the question, but this is what I have so far and I need each 6 rows to look like the bottom example.


I should also mention that I used AttributeCreator to create an aggregate Field and populated it with a value of 1 using the Aggregator Transformer to get the bottom image, that is were my thinking of needing a aggregate field that indicates each 6 rows, such as 111111, 222222, 333333, etc to be able to get all the fields to look like the bottom image.. is this thinking correct?


Are your objects always exactly fifteen rows long? Do they always begin with "vendor name"?

What format are you reading in? If it's a text format, there are almost certainly easier ways of doing this using the reader.


If the number of rows between Vendor name were equal I would probably just use a ModuloCounter, if they are variable I would do something like the attached image.

essentially each new Vendor Name is a trigger to increase the count, every feature between a "Vendor Name" feature will be assigned the same value via settting and retrieving variables.


Are your objects always exactly fifteen rows long? Do they always begin with "vendor name"?

What format are you reading in? If it's a text format, there are almost certainly easier ways of doing this using the reader.

It is an excel format and actually no the rows are only 6 rows long and start from Vendor Name and end at Fax number, the image I used is all I have at the moment because I do not have access to my FME Desktop. also their is an ID field that has a number 1-6 that starts from Vendor Name down to Fax Number and then repeats 1-6 for each set of attributes, from Vendor Name to Fax Number again.


If the number of rows between Vendor name were equal I would probably just use a ModuloCounter, if they are variable I would do something like the attached image.

essentially each new Vendor Name is a trigger to increase the count, every feature between a "Vendor Name" feature will be assigned the same value via settting and retrieving variables.

JDH, thanks I will give that a shot as soon as I can.


OK - you should be able to do that with just two transformers, using Advanced Attribute Value Handling in an AttributeCreator. The tester then allows through only every sixth feature, which should have gathered all the attributes you need.

Attribute_Counter = "ID field that has a number 1-6"

value = "SUPPLY_REQUEST00" in your table screenshot

Of course, if the schema varies, or the number of attributes per feature change, it gets a lot more complex!


OK - you should be able to do that with just two transformers, using Advanced Attribute Value Handling in an AttributeCreator. The tester then allows through only every sixth feature, which should have gathered all the attributes you need.

Attribute_Counter = "ID field that has a number 1-6"

value = "SUPPLY_REQUEST00" in your table screenshot

Of course, if the schema varies, or the number of attributes per feature change, it gets a lot more complex!

Of course, I lose points for using an AttributeCreator rather than AttributeManager... still, that should work!


Of course, I lose points for using an AttributeCreator rather than AttributeManager... still, that should work!

lol, I will award you 10 extra points for citing and correcting yourself, Rollo thank you for the help.


Hi @kelbyt, I would try this.

  1. AttributeExposer: Expose "_group_id" and the required 6 attributes.
  2. AttributeCreator: Create the value of "_group_id". The value should be incremented whenever "Vendor Name" occurs in the "SUPPLY REQUEST" field.
  3. BulkAttributeRenamer: Rename "SUPPLY REQUEST00" to the value of "SUPPLY REQUEST".
  4. Aggregator: Aggregate the features grouping by "_group_id".


I think @jdh is correct that you should use the ModuloCounter, but you need to follow it up by a regular Counter transformer. Basically these steps:

1) Use a ModuloCounter. Set Count Maximum = 6

2) Use a Counter. Set Counter Name = _modulo_count

3) Use an Aggregator. Group by _count

This will give you aggregate features consisting of 6 rows at a time.


OK - you should be able to do that with just two transformers, using Advanced Attribute Value Handling in an AttributeCreator. The tester then allows through only every sixth feature, which should have gathered all the attributes you need.

Attribute_Counter = "ID field that has a number 1-6"

value = "SUPPLY_REQUEST00" in your table screenshot

Of course, if the schema varies, or the number of attributes per feature change, it gets a lot more complex!

rollo,

I was finally able to test this out and it worked perfectly, thanks.


Hi @kelbyt, I would try this.

  1. AttributeExposer: Expose "_group_id" and the required 6 attributes.
  2. AttributeCreator: Create the value of "_group_id". The value should be incremented whenever "Vendor Name" occurs in the "SUPPLY REQUEST" field.
  3. BulkAttributeRenamer: Rename "SUPPLY REQUEST00" to the value of "SUPPLY REQUEST".
  4. Aggregator: Aggregate the features grouping by "_group_id".

Takashi,

thank you for your help and advice I will test yours out as well, seeing as how short it is, if I can get this to work it would be a lot cleaner. Rollo's method worked for me, seeing how far into the workbench I was. agian thanks for the help.


Reply