Hi,
I have a list of nodes, I have two runtime properties on the nodes referenceId and parentReferenceId, (these are from an external source)
When I iterate over them to build our “normal” parent child relationship with node.Parent I do this:
For every element in _m_DR_Node (temp) if it is has no parent and if it has a parentReference, try to find the Node with referenceId where current node iteration has parentReferenceId and set that to _m_DR_Node (temp single) before setting that to be the current node iterations parent.
This is the filter on the first Read objects to node:
This does not function, _m_DR_Node (temp single) never gets a value (both has the same set of runtime properties)
This works if I use JavaScript in the Update object in context and set the Parent directly with this:
Marcus
Hi Marcus,
Intersting discovery. This most likely happens because the filter in this case is Context Aware. In your case, you are checking if _m_DR_Node.referenceId (Object in Context) EQ _m_DR_Node.parentReferenceId (Object in Context)
. I am guessing that what ends up happening is that you are therefore checking if the Object in Context has the same referenceId and parentReferenceId.
In your JS function, you are doing something different. Here you have (most likely) databound the entire _m_DR_Node datasource, and the parentReferenceId in Context. So you are evaluating all possible referenceIds against a the parentReferenceId in Context. (If that makes sense)
One possible solution to this, is to store the parentReferenceId
that you want to lookup in a single-cardinality variable. In my example, I have made an App Variable, that is updated for every iteration. Then I read to the single-cardinality source, where referenceId EQ parentReferenceId (In App Variables)
. This is more akin to how your function is setup. When running my example, this is the result.
// Erik
The “Read objects to _m_DR_Node (temp single)” reads from other, in this case “_m_DR_Node (temp)”, which indeed is the subject of the context, if the left side of the equals operates on the context, in the same way as the right side, would that not be a bug?
My JavaScript function does exactly what I would expect the “Read objects to _m_DR_Node (temp single)” to do.
Find the first element in the “_m_DR_Node (temp)” list where node.referenceId == myCurrentContextNode.parentReferenceId
and set that as parent.
Marcus