Skip to main content
Solved

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


Forum|alt.badge.img+1

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.

Best answer by ebygomm

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

View original
Did this help you find an answer to your question?

3 replies

takashi
Influencer
  • April 25, 2021

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.


Forum|alt.badge.img+1
  • Author
  • April 25, 2021
takashi wrote:

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


ebygomm
Influencer
Forum|alt.badge.img+33
  • Influencer
  • Best Answer
  • April 27, 2021

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


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