2

I'm using FME to look at a large directory and filter down through many factors to handle the data within the directory.

One of the stages I am working on is to search for companies that own the data. These we call 'Third Party Users'.

The third Party list is around 60 company names. I've used a Tester for each condition. This works fine.

What I need to know is how many times these particular names were found within this Test.

I just need this as a list seperate to where my workspace goes after this transformer, or it could be added on to the spreadsheet, I don't mind. I'd just like those stats.

I'm struggling with this because this particular list, is not listed as an attribute. They're listed in the tester.

Here is a TEST Example. Say this is the spreadsheet (my own has about 300,000 rows) enter image description here

Now, say I want to filter this spreadsheet only on the following companies, and I want to know how many times they exist.

enter image description here

The result should essentially only kick out those where in column A includes AAPG and DPD.

AND should tell me:

AAPG exists 2 DPD exists 2

1
  • Kim why not consider closing one of the answers if that works for you? Feb 28, 2018 at 8:20

3 Answers 3

3

You may want to try using the statisticsCalculator using the groupby set to the attribute company in your case i suppose. This shuold give you the breakdown values by company if i understood well your question.

5
  • But the list of companies I'm searching for are not listed as an attribute, that's where I'm struggling because I need the stats based on the Tester conditions.
    – Kim
    Feb 22, 2018 at 12:39
  • You may want to post some example data for better understanding. Wondering if you some how could create the attribute company once you said you can filter it using the tests Feb 22, 2018 at 12:45
  • I've added some examples, hopefully this helps?
    – Kim
    Feb 22, 2018 at 12:57
  • You could parse the FilePath to get the company names into an attr. 1-With an attributeSpliter on FilePath attrib, split the attrib using the '/' as delimiter. 2-It will create a _list{} with elements of the split. 3-Now use a listElementCounter so you know the max amount of elements in list. 4-Since company name is always the last element of the _list{}. 5-Now with the listElementCounter attrib use it in listIndexer to promote the last _list{} element (company) to a new attrib 'Company'. 6-Now you have an attrib with the 'company' to use on statisticsCalculator for grouping. Feb 22, 2018 at 14:30
  • StringFunctions will also work docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Workbench/… > StringSearcher and put the matches into a list, then expose the list and count the elements...
    – Mapperz
    Feb 22, 2018 at 15:54
1

Use a FilenamePartExtractor transformer to extract the name from the filename. Then use a StatisticsCalculator (as Jorge says) with group-by set to the extracted name.

It doesn't matter what attribute you select to analyze, you only want to set the Total Count Attribute for the attribute to calculate.

There's actually a FeatureCounter custom/hub transformer that would help (replace the StatisticsCalculator) but it doesn't do groups. I'll upgrade that so it does.

2
  • 2
    I just updated the FeatureCounter transformer on the FME Hub (hub.safe.com/transformers/featurecounter) with a group-by parameter, so you can use that instead of the StatisticsCalculator and not have to worry about which attribute to analyze or what outputs to set/delete. Feb 22, 2018 at 17:12
  • Thank you for your reply. I'm really stuck on how I list the company names in the FilenamePartExtractor?
    – Kim
    Feb 27, 2018 at 11:11
0

Thank you all for the comments. Unfortunatley they did not quite work for me, maybe I wasn't explaining it correctly. But I did take part of them and they came in use. I did the following: enter image description here

Within the attribute Creator, it was setup with 85 possible values. Using "Elseif" as a condition.

This worked perfectly.

Thanks for your help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.