Jump to content

Set property for capsules


Recommended Posts

  • Super Seeqer

I am sure that there are probably a few ways to do this but here is a solution I came up with 

$conditionToSamples = $condition.aggregate(count(),$condition,durationkey())

$countingRange = condition(capsule('2020-01-01T00:00Z', '2023-01-01T00:00Z'))

$countSignal = $ConditionToSamples.runningsum($countingRange)

$condition.setProperty('Capsule Count',$countSignal,average())

Step by Step Outline 

  1. $conditiontoSamples - Take your input condition and turn it into a signal with a value of 1 whenever the condition exists 
  2. $countingRange - the range we are going to count these capsules over. In this example beginning of 2020 to beginning of 2023
  3. $countSignal - Create a signal that counts up those values for each condition starting at the start date 
  4. Set the value of the $countSignal as a property on your original condition 


Link to comment
Share on other sites

  • Seeq Team

Depending on whether you want the numbers to be 1-6 or just a unique identifier, another common approach is to use the timestamp of the start of the capsules. In this case, you could do something like:

$condition.setproperty('ID', $condition.tosignal('start').tostring(), startvalue())


Link to comment
Share on other sites

Thanks, Shamus and Joe!  How about any numbers which are not coming from signals, let's say 23, 14.5, -3, 0, 65, 4, could we set those numbers as properties of the capsules?  

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...