Skip to main content
Question

I have an Id field in a table & need to add the max id + 1 to a new set of features with the same field name


I have an Id field in a table & need to add the max id + 1 to a new set of features with the same field name

4 replies

takashi
Influencer
  • November 3, 2015
You can use the StatisticsCalculator to get the maximum value of the Id field. However, I'm unclear what the next requirement is. Where will the "new set of features" come from?

pratap
Contributor
Forum|alt.badge.img+11
  • Contributor
  • November 3, 2015
Yes, StatisticsCalculator + ExpressionEvaluator will address this

  • Author
  • November 3, 2015
Thanks, The second table is a subset that need the new id so that when I place them back into the first non spatial table the numbers are unique. The non spatial table will have entries from table 2 and table 3.

takashi
Influencer
  • November 3, 2015
A possible way is:

 

get the maximum value of Id in the first table with a StatisticsCalculator,

 

merge the "max Id" to the subset features unconditionally with a FeatureMerger,

 

then add Id starting with (max Id + 1) to the features using a Counter.

 

e.g.

 

 

To merge "Id._max" to the subset features unconditionally, set an identical constant value (e.g. 1) to the Join On parameter for both Requestor and Supplier.

 

 

If the first table was stored in a database, you can also use the SQLCreator or SQLExecutor to get the maximum Id value efficiently with a SQL statement like this.

 

select max(Id) as maxId from first_table;

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