I use an action
to create a sibling
entry in a collection
with an acyclic-graph
constraint. In this action
the user has to provide a number of pieces. The maximum allowable number of pieces to be provided is determined by:
- the number of pieces in the current entry, from which the
sibling
will be created - the in the action provided way of dividing units of the current entry
- the in the action provided factor in which units of the current entry should be divided
Here my boiled down code sample (incomplete!!) :
'Maak deelpartij': action {
'Versnijd-sleutel': stategroup (
'Volgens model' { }
'Vrij te kiezen' {
'Eenheid versnijd-sleutel': stategroup (
'Stuks per kaas' {
'Versnijd-sleutel': number positive 'stuks per kaas'
}
'Stuks per stuk' {
'Versnijd-sleutel': number positive 'stuks per stuk'
}
)
}
)
'Aantal nieuw model': number positive 'microstuks'
@max: switch @ .'Versnijd-sleutel' ( // <-- this `switch` is not allowed!
|'Volgens model' as $'model' => switch ...
|'Vrij te kiezen' as $'vrij' => switch $'vrij'.'Eenheid versnijd-sleutel' (
|'Stuks per kaas' as $'kaas' => product ( ... , ... )
|'Stuks per stuk' as $'stuk' => product ( ... , ... )
)
)
} => update ^ .'Partijen'
= create ( ... )
I can’t create a derivation to be used by the @max
annotation, since it’s inside an action.
I need the action to properly create the sibling entry.
How to deal with this situation?