Solved

Count the number of a value found in another table within gdb (Primary, Foreign Key feilds)

  • 24 April 2021
  • 3 replies
  • 6 views

Badge

Hi 

i am relatively new FME user. i am trying to complete a task but any path i pick i crash on a wall. I have an SDE drive with feature classes and table. Each feature class record has a primary key which is linked to my tables through a foreign key field. I need to know who many times a primary key value is found in my tables, create a new feature class and give in separate fields named (1st visit, second visit etc) some information about the table the record was found.

What is the best path and how to get there.

icon

Best answer by ebygomm 27 April 2021, 10:24

View original

3 replies

Userlevel 2
Badge +17

Hi @dionysios​ , if you need to get the number of occurrence for each value in an attribute, consider using the StatisticsCalculater with setting the attribute to the Group By parameter.

Badge

Hi @dionysios​ , if you need to get the number of occurrence for each value in an attribute, consider using the StatisticsCalculater with setting the attribute to the Group By parameter.

Thanks Takashi, yes that worked for the part of finding the occurrences

Userlevel 1
Badge +10

This is how I would probably approach it

  • Number each occurrence of the FeatureID in the table
  • Create a new attribute named using this number and setting it's value to the information relevant
  • Expose the newly created attribute (1,2,3)
  • Rename to be Visit_1,Visit_2,Visit_3 etc.
  • Aggregate, counting total number of occurrences and merging so you end up with a single feature per FeatureID with Visit information
  • Keep only the bits you need

 

CaptureThis gets you something like thisCapture1You can then merge the geometry back onto this plus any other information from your original feature class tables

 

The tricky bit is if you don't know how many visits you have to account for and thus what numbers of attributes to expose

Reply