I have a workspace producing various outputs, I'd like to produce a further output which details the number of distinct customers and number of distinct products for each output but this appears to be either convoluted involving multiple steps and statistics calculators or slow involving a count distinct in the inlinequerier. Wondering if I'm missing a trick
You can use listbuilder followed by a , listhistogrammer
GroupBy the Attribute you want to have distinct element counted for.
I don't think that will work, the two things are independent.
e.g. in the following I would want the customer value to be 2 and the product value to be 3
Python to the rescue? or is it R time?
Hi @egomm,
When I am in this situation I make use of a PythonCaller in order to create statistics. If you would need some help with that, just let me know!
This custom transformer should do the trick.
This custom transformer should do the trick.
I also think that Python scripting would be an efficient solution, but if the destination dataset is a database, SQL querying might also be worth to try.
This custom transformer should do the trick.
Perfect,thanks
@egomm
Your example can easily be solved by..
Matcher followed by a statisticscalculator grouped by fme_feature_type...
Put in a custom for ease of use...
When using custom explode the features so you can use attr_name as input
No need for python or whatever.
And if its in a database then of course you would use sql.
This custom transformer should do the trick.
A
1
1
1
2
3
0
0
Output should look like:
0 -> 2
1 -> 3
2 -> 1
3 -> 1
A
1
1
1
2
3
0
0
Output should look like:
0 -> 2
1 -> 3
2 -> 1
3 -> 1
- Group By: A
- Attributes to Analyze: A
- Total Count Attribute: <an attribute name which will store desired count value>
- Group By: A
- Attributes to Analyze: A
- Total Count Attribute: <an attribute name which will store desired count value>
UniqueValueLogger
https://hub.safe.com/transformers/uniquevaluelogger