I believe I have what you want (but I am half-asleep, so its what I initial thought first thing in the morning), however if you are new to FME you will have to get your head around exposed and not-exposed attribute.
So initially you should use the StatisticsCalculator, grouping by Sample-N and Methodology code and doing a sum on the result
Use the feature coming out of the summary port and go into an attribute creator
In the attributecreator, set the new value as an attribute value (use the drop down) and set to methodology-code/ And the right field, set to the ...sum field. This will create an attribute such as 1113 and the value associated, but it is not an exposed attribute (e.g. you won't see the attribute name inside the workspace)
Then use an aggregator and set group by as sample-n and then aggregate mode as attributes only and accumulation mode as merge incoming attributes.
Note that the below doesn't show the attribute in the table, but does in the feature info window.
I believe I have what you want (but I am half-asleep, so its what I initial thought first thing in the morning), however if you are new to FME you will have to get your head around exposed and not-exposed attribute.
So initially you should use the StatisticsCalculator, grouping by Sample-N and Methodology code and doing a sum on the result
Use the feature coming out of the summary port and go into an attribute creator
In the attributecreator, set the new value as an attribute value (use the drop down) and set to methodology-code/ And the right field, set to the ...sum field. This will create an attribute such as 1113 and the value associated, but it is not an exposed attribute (e.g. you won't see the attribute name inside the workspace)
Then use an aggregator and set group by as sample-n and then aggregate mode as attributes only and accumulation mode as merge incoming attributes.
Note that the below doesn't show the attribute in the table, but does in the feature info window.
Thanks a lot for taking the time.
Unfortunately I encounter the same error I had before with the AttributeCreator:
AttributeCreator (AttrSetFactory): An error occurred while evaluating the above expression. If the failed expression is arithmetic, check to ensure there is a numeric value specified as the substitution value for null, empty and missing attributes.
AttributeCreator (AttrSetFactory): AttributeCreator: Failed to evaluate input expression: @Value(Methodology-Code)
specifying the substitution value did not solve the problem unfortunately
Thanks a lot for taking the time.
Unfortunately I encounter the same error I had before with the AttributeCreator:
AttributeCreator (AttrSetFactory): An error occurred while evaluating the above expression. If the failed expression is arithmetic, check to ensure there is a numeric value specified as the substitution value for null, empty and missing attributes.
AttributeCreator (AttrSetFactory): AttributeCreator: Failed to evaluate input expression: @Value(Methodology-Code)
specifying the substitution value did not solve the problem unfortunately
Does it log the feature that caused the failure in the log. If so, check what the Methodology-Code value of that feature. If not, assuming that is the Methodology-Code is always a number, how about putting a tester prior to the attribute creator and do a test for Methodology-Code type is integer. You could investigate what fails that test.
I just tested the field for numerical, all passed. I tried the process on the little test-table above which also recreated the error per verbatim:
I just tested the field for numerical, all passed. I tried the process on the little test-table above which also recreated the error per verbatim:
That looks a little weird. The bit I am confused about is the statement that it is unable to "evaluate". Like it is treating it a calculation. Its not doing the same thing for me and only when I do ask it to evaluate it, does it throw the same error. I would contact Safe support and see what they say.
That looks a little weird. The bit I am confused about is the statement that it is unable to "evaluate". Like it is treating it a calculation. Its not doing the same thing for me and only when I do ask it to evaluate it, does it throw the same error. I would contact Safe support and see what they say.
still thank you again for taking the time, I think I just found another solution that looks like this. At least with the test data it looks promising:
Its not automatic as I will have to pick the exposed attributes by hand but I hope it it gets the job done.
For curiositys sake: How do I ask it to evaluate? Maybe thats an option I have active by default without realising?
That looks a little weird. The bit I am confused about is the statement that it is unable to "evaluate". Like it is treating it a calculation. Its not doing the same thing for me and only when I do ask it to evaluate it, does it throw the same error. I would contact Safe support and see what they say.
Using an Arithmetic expression which implements the @Evaluate function. But its not immediately available in the new attribute field in attribute creator, but is on the right side of the form
@pkno
It appears the Failed to evaluate input expression error may be related to the numeric data type of the Methodology-Code attribute. If you force the attribute value to a string, the AttributeCreator completes successfully. This behaviour may be a bug and I will file a bug report for our development team.
To cast the attribute value to a string, use either the BulkAttributeRenamer transformer or use the @Format function with the flag %4s in the AttributeCreator when creating the transposed attribute.
I have attached a workspace demonstrating both these approaches and I hope it helps.