Jump to content

Add data from sub-batches into 1 total


Recommended Posts

Hi Seeq.. it is possible to sum the "Product door UHT"  and "Product naar Vullen\/Surgetank via NV1 klep"  at the time of both sub-batches

So I want to sum all bars (green and purple) where batch value 33780NR001 and 33780NR002 are true... please guide me towards a solution..


Link to comment
Share on other sites

  • Seeq Team

Hi robin,

I would start by creating a capsule that represents the entire time frame that you want to sum up the values for. If you want those two sub-batches together in the summation, you'd likely want to either do a regex value search that would capture both of those values (but not any others) or the simpler method would be to simply do a value search for each of the individual sub-batch values and then perform a "join" using composite condition to join the first one to the second. That should provide a single capsule that goes across both sub-batches.

After that, you need to do your summation. The easiest method would be to use Signal from Condition to perform a sum of the green signal during the capsule created above and place that wherever you want the value to be (I'd suggest using duration as the timestamp so that you can see the statistic goes across both sub-batches). Repeat the same Signal from Condition for the purple signal as well. After that, you can use Formula with $GreenSignalFromCondition + $PurpleSignalFromCondition to complete the summation you'd like.


Link to comment
Share on other sites

The problem is that the batchnr changes everytime... and the number of sub-batches also... 

The first 7 char. are unique and than it can be 001 till .... 00y. 

And we need to capture the total per unique batch xxxxxNR001 ... xxxxxNR00y for all batches, past , present and future...


Link to comment
Share on other sites

Hi Robin,

you can create a batch condition by using replace() to extract the batchnumber and toCondition() for creating the capsules for each batch:

$subbatches.replace('/(\\d{1,7})NR\\d{3}/', '$1').toCondition()


In the next step you can do the aggregation:

$v1.aggregate(sum(), $batch.removeLongerThan(1wk), middleKey()) +
$v2.aggregate(sum(), $batch.removeLongerThan(1wk), middleKey())




Edited by Thorsten Vogt
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...