Skip to main content
Solved

How to Use Summary Output from Statistics Calculator as part of calculation

  • January 3, 2019
  • 5 replies
  • 322 views

Forum|alt.badge.img

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

Best answer by mark2atsafe

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

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

itay
Supporter
Forum|alt.badge.img+18
  • Supporter
  • January 3, 2019

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


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • January 3, 2019

@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

 


mark2atsafe
Safer
Forum|alt.badge.img+58
  • Safer
  • Best Answer
  • January 3, 2019

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

 


Forum|alt.badge.img

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!


jtorre5363
Forum|alt.badge.img

 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