Interface Definition: Expression evaluation error at function a!hierarchyBrowserFieldTree [line 31]: A tree browser component [label=""] encountered an error for "nextLevelValues" when fv!nodeValue was [id:0,name:JobType,description:Description for node roleType,details:I have 1 child node,type:FOUNTAIN_PEN,numberOfChildren:2,isDrillable:true]. The following error was returned: Expression evaluation error at function 'enumerate' [line 39]: Cannot enumerate non-scalar.
When I am trying to use enumerate in nextLevelValues using foreach getting this error. Please let us know any suggestions on this. Thanks in advance.
Discussion posts and replies are publicly visible
Can you share the code for more information
a!hierarchyBrowserFieldTree( pathValue: local!path, pathSaveInto: local!path, nextLevelValues: a!forEach( /* Make a number of values in the next level equal to the number of children */ items: if( isnull(fv!nodeValue.numberOfChildren), enumerate(0), enumerate(fv!nodeValue.numberOfChildren) ), expression: a!localVariables( /* Give the new node a random number of children between 0 and 10 */ local!numberOfChildren: wherecontains( tointeger( index( local!jobFunction, 'recordType!{1ff9ad37-4289-4671-993e-73ee3f4cffff}CRI Function.fields.{5eeb91de-e4fd-4d7c-9cc3-ddb20eac48ee}id', {} ) )[fv!index], tointeger( index( local!jobFamilyGroup, 'recordType!{0ac046d5-58a9-4d1e-8c9c-19b64a5a95c9}CRI JF Group.fields.{a021ee14-ea90-44e2-8b54-1bc298294834}jfgid', {} ) ) ), /* Make only even nodes drillable */ local!isDrillable: true(), { a!map( id: fv!item, name: index( local!jobFunction, 'recordType!{1ff9ad37-4289-4671-993e-73ee3f4cffff}CRI Function.fields.{a11ba965-2b5a-4a8b-9b31-6baad64974f0}functiontype', {} )[fv!index], description: "Description for node " & index( local!jobFunction, 'recordType!{1ff9ad37-4289-4671-993e-73ee3f4cffff}CRI Function.fields.{a11ba965-2b5a-4a8b-9b31-6baad64974f0}functiontype', {} )[fv!index], details: if( local!isDrillable, if( length(local!numberOfChildren) = 1, "I have 1 child node", "I have " & length(local!numberOfChildren) & " child nodes" ), "I am not drillable" ), type: if( fv!nodeValue.type = "AIRPLANE", "FOUNTAIN_PEN", "AIRPLANE" ), numberOfChildren: local!numberOfChildren, isDrillable: true() ) } ) ), nodeConfigs: a!hierarchyBrowserFieldTreeNode( id: fv!nodeValue.id, label: fv!nodeValue.name, description: fv!nodeValue.description, details: fv!nodeValue.details, image: a!documentImage( document: if( fv!nodeValue.type = "AIRPLANE", a!iconNewsEvent("PAPER_AIRPLANE"), a!iconNewsEvent("FOUNTAIN_PEN") ) ), isDrillable: fv!nodeValue.isDrillable, nextLevelCount: fv!nodeValue.numberOfChildren ) )
Please refer once
There could be a possibility that fv!nodeValue.numberOfChildren is taken as list. Casting it to integer should solve it. Please replace the code items of foreach()
if( isnull(fv!nodeValue.numberOfChildren), enumerate(0), enumerate(cast(1,fv!nodeValue.numberOfChildren)) )