How to differentiate scope in calc expression?

#1
entity type MyType schema name 'MYTYPE' {
  quantity: ExactDimension

  date: datetime

  parent: ParentType

  newQuantity: ~ stored calc "quantity - parent.myTypeHistory.(date < date)[0].quantity"
}

entity type ParentType schema name 'PRNTYPE' {

  myTypeHistory: [MyType](parent)
}

How do I differentiate in the filter between the date on the myTypeHistory and the date on MyType?

0 Likes

#2

You can traverse the data model the same way you would normally:

newQuantity: ~ stored calc "quantity - parent.myTypeHistory.(date < parent.date)[0].quantity"
0 Likes

#3

Actually it turns out what i am trying to do is not possible. The expression engine does not support it, as of now.

0 Likes