Skip to main content

Hello,

This should be a very simple thing, but I just can't figure out how to do it!

I want to append two tables together (Tables 1 & 2), both with very similar attributes, but I want to use the ID from Table 1 as the official Primary Key, and then get the highest number from that PK and increment upwards to create new PK values for the Table 2 appended values. I can get the maximum value from Table 1 using StatisticsCalculator, but I can't for the life of me work out how to use that value in the creation of the new Primary Key.

I've been trying to do a conditional value calculation in Attribute Manager, something like, if Table 1 ID has a value, then PK = Table 1 ID, else use MaxValue from StatisticsCalculator and sum it with @sum(@double(@Count()),1.0) to increment up. But it's not working.

Any ideas greatly appreciated!

Thank you!

Katrina

Hi @katrinaopperman,

If what you require is an increment on the highest value from table 1 ( max value from statistics calculator) then you can use a Counter to add to that value.

Alternatively if you are writing to a database, you can set up a sequence on the database starting from the max value and let de database take care of the PK increment.

Hope this helps,

Itay


@katrinaopperman

 

Hi.

 

The max. value you acquired from the Statistics Calculator summary output should be merged to the data from table 2.

So either you use a unconditional merger (requestor Key=Suplier Key, I usually simply do 1=1)

Or use, if the process stream allows it a variable setter and retriever).

The value is then related from table1 stats to table2.

Now u can (re)calculate the PK for table2. You can indeed use a counter and set it to start at the (related) max value +1

 


I tried to make something and it came out pretty much like @itay and @gio said. StatisticsCalculator, FeatureMerger, Counter. Like this:

 


I tried to make something and it came out pretty much like @itay and @gio said. StatisticsCalculator, FeatureMerger, Counter. Like this:

 

Brilliant! Thank you @Mark2AtSafe, @gio, and @itay! That worked perfectly!


 I want to write a summery of george washingtons farwell adress answering the following questions

 

what were the most important details? what was the policy of isolationsm? and describe the important precedents that washington established