Skip to main content
Solved

Generating Tabular Results from Multiple Features...


Hi,

 

I'm having trouble restructing my (aspatial) data from what I can best describ as multiple rows per uninqe identifer each containing a feild name and respective value to a single row per feature per feature where there field name values become columns. The example below probably explains this better:

 

 

---INPUT----

 

ID,Field,Value

 

1,FieldA,Cow

 

1,FieldC,Sheep

 

2,FieldA,Dog

 

2,FieldB,Mouse

 

2,FieldC,Cow

 

 

---DESIRED OUTPUT---

 

ID,FieldA,FieldB,FieldC

 

1,Cow,,Sheep

 

2,Dog,Mouse,Cow

 

 

Does anyone have any tips as to how this is best don? Aggreagting is based on the ID is easy, but manipulating the resultant list items into the format of the desired output is eluding me.

 

 

Regards. Rob.

Best answer by takashi

Hi Rob,

 

 

I would use the BulkAttributeRenamer and the Aggregator.

 

BulkAttributeRenamer

 

 

 

Aggregator

 

Group By: ID

 

Mode: Attribute Only

 

Keep Input Attribute: Yes

 

 

Then, you can expose required attribute names (FieldA, FieldB, and FieldC) with the AttributeExposer.

 

 

Takashi
View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • January 30, 2015

 

You can use the excel writer technique described below (Pratap's question).

 

 

ID = xlsx_row_id.

 

@(Value(@Value(Field)) =@Value(Value)

 

Input written to csv schema for exposer.

 

need modern excelwirter for that though (i use fme2014sp2 and newer)

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • January 30, 2015
U can

 

listbuilder on ID.

 

Listelementconter.

 

Attributecreator for a index.

 

 

 

Listindexer in a loop/ customtransformer

 

 

 

 

Like in previous suggestion, you must create a csv from the input data to use as a schema for the exposer. (import values)

takashi
Influencer
  • Best Answer
  • January 31, 2015
Hi Rob,

 

 

I would use the BulkAttributeRenamer and the Aggregator.

 

BulkAttributeRenamer

 

 

 

Aggregator

 

Group By: ID

 

Mode: Attribute Only

 

Keep Input Attribute: Yes

 

 

Then, you can expose required attribute names (FieldA, FieldB, and FieldC) with the AttributeExposer.

 

 

Takashi

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • January 31, 2015
that techniques is the same as just creating attributes and grouping them:

 

Attribute_name = @Value(@Value(Field))

 

Attribute_value = @Value(value).

 

Don't need a renamer for that.

 

 

You then have a table where FIELDB is missing on the first row.

 

My techniques don't have that flaw.

 

(unless htat is not a issue....)

 

 

Also i would write out the table to a csv (or other format)  and then use it as schema.

 

Unless you like to manualy expose attributes.

  • Author
  • February 2, 2015
Gio, Takashi,

 

 

Thanks both for your responses. My final approched used Takashi solution, but the AttributeCreator in place as the BulkAttributeRenamer as suggested by Gio Both produce the same result though.

 

 

Regards. Rob.

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