Skip to Main Content

Analytics Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Javascript-Derived 'Associated Node' Property, when used in DRG, Nulls generate Errors

MNWApr 24 2017 — edited Apr 24 2017

Hi all,

I searched the support KB and the forums here and feel confident that this hasn't been asked yet. I have the need for a derived, Associated Node(s) property. I put the 's' in parentheses because I'm fairly sure the property needs to be Local. It's a little difficult to explain the logical requirement, but I'll do my best.

Requirement

Leaf Nodes should be associated with one another according to their limb parent. The first node (in numeric order) under a parent should map to the last node (in numeric order) under the same parent. All other nodes under the parent (Including the last node) should map to the first node under that parent.

Example structure (Node Name - Property Value):

Hierarchy Alpha   

     Parent A - Null

          Child 1 - Child 3

          Child 2 - Child 1

          Child 3 - Child 1

          Child 4 - Child 1

Current Approach

I'm using a derived Javascript Associated Node property to calculate this. It works perfectly in interactive mode with no errors. Below is the script:

var parentList = [];

   parentList = node.Parent.GetChildren("hier");

   

   //return null if member is a limb or if the node is not in the COSTCENTER hierarchy (The same node may be linked in other hierarchies and these should have null values)

   if (!node.Leaf || !node.PropValue("Custom.EXP_CC") || !(node.Hier.Abbrev=="COSTCENTER")) {

      return null;

   }

   //Splice all limbs from the array and any Cost Centers that shouldn't be exported or considered for mapping

   for (x=0;x<parentList.length;) {

       if(!parentList[x].Leaf || !parentList[x].PropValue("Custom.EXP_CC")) {

parentList.splice(x,1);

       } else {

x++;

       }

   }

   //If the nodes aren't in numerical order under the same parent, order them numerically

   parentList.sort();

   //If the first child of the parent, return the parent's last child. Otherwise, return the parent's first child

   if (node.Abbrev==parentList[0].Abbrev) {

      return parentList[parentList.length-1].Abbrev;

   } else {

      return parentList[0].Abbrev;

   }

Problem

This works well in interactive mode. But when used in a DRG workflow, there's a problem. In the case that the node is changed from "EXP_CC==TRUE" to "EXP_CC==FALSE", the property logic returns null, which triggers an error that says "TypeError: Can't convert Undefined, Null or CLR to Object". What I think is happening is that the Associated Node property is returning the value of "Null", which isn't a valid node. In interactive mode this isn't a problem because when you change the Export value from True to False, the Calculated value isn't considered an override.

In DRG, however, I think all updated property values (Including calculated properties) are considered overrides and you can't override an Associated Node value with a null value.

I'd love some guidance on this. I know it's a really specific situation but I think the basic question is: How, in DRG, can I pass a null value to an Associated Node property using Javascript?

Thanks for taking a look!

M

Comments

EdStevens

This really has nothing to do with SQL Developer (the subject of this forum). It is a much better fit in SQL & PL/SQL.
And just as a side comment, storing 'age' as data is a flawed design. The 'age' of everyone and every thing is increasing by the day, if not by the second. What is your plan to keep 'age' current? Better to store 'date of birth' and the calculate 'age' when needed at run-time.

User_H3J7U

The 'age' of everyone and every thing is increasing by the day, if not by the second.
Sometimes the age stops increasing.
изображение.png

EdStevens

Pour me one!
Of course, that's not actually the age, but the amount of time it was 'aged' in the barrel before bottling.

1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details