Jump to content

Set a property from a "parent" capsule to a "child" capsule


Recommended Posts

  • Seeq Team

When working with Conditions, it may be helpful to apply a property from another Condition with larger time frames, e.g. batch procedures, orders, and equipment states.

 20190428_ParentPropertyToChildProperty1.png

Here is one approach:

$childCondition.transform($cap ->
     $cap.setProperty('Stage', 
          $ParentCondition.toGroup($cap).first().getProperty('Value')
     )
)

$childCondition are the red capsules and ‘Stage’ is the property that you will create with the ‘Value’ property from the green $parentCondition.

20190428_ParentPropertyToChildProperty2.png

  • Like 2
Link to comment
Share on other sites

  • 4 months later...
  • 3 years later...
  • Seeq Team

It is also possible to set properties from child capsules to a parent capsule. This is more complex as there could be a variable number of child capsules associated with each parent capsule. Inside the transform, you will pick the desired child capsule (1st, 2nd, 3rd, etc.) and define an alternate capsule with a filler property value to be used if the desired pick does not exist within the parent capsule. 

$parentCondition.removeLongerThan(40h).transform($capsule -> $capsule.setProperty('1st Child Property',
$childCondition.removeLongerThan(40h).toGroup($capsule).pick(1, capsule($capsule.endKey(), $capsule.endKey()).setProperty('Child Property', 'none')).property('Child Property')))

.transform($capsule -> $capsule.setProperty('2nd Child Property',
$childCondition.removeLongerThan(40h).toGroup($capsule).pick(2, capsule($capsule.endKey(), $capsule.endKey()).setProperty('Child Property', 'none')).property('Child Property')))

.transform($capsule -> $capsule.setProperty('3rd Child Property',
$childCondition.removeLongerThan(40h).toGroup($capsule).pick(3, capsule($capsule.endKey(), $capsule.endKey()).setProperty('Child Property', 'none')).property('Child Property')))

 

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