I am trying below code. Here, expression rule GPO_questionDetails returns a list for a given number.a!gridLayout( label:"program",headerCells: { a!forEach( items: {"230108","230109","230110"}, expression:{ a!localVariables( local!list: rule!GPO_questionDetails(questionID: fv!item), a!gridLayoutHeaderCell(label: local!list.label) )} ), if(not(rule!APN_isTrue(ri!isReadOnly)),a!gridLayoutHeaderCell(label: ""),{}) },Error: Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!gridLayout [line 35]: A grid component [label="program"] has an invalid value for "headerCells". "headerCells" can only be of type GridLayoutHeaderCell. Received List of GridHeaderCell at index 1.Can some one help me to fix this ?
Discussion posts and replies are publicly visible
Hi,
Using a flatten() function will help you in this case:
headerCells: { a!flatten( a!forEach( items: { "230108", "230109", "230110" }, expression: { a!localVariables( local!list: fv!item, a!gridLayoutHeaderCell(label: local!list) ) } ) ) }
Avoid the {} in your a!forEach expression parameter. you are doing a "a!forEach(items:{1,2,3}, expression:{...})just do a "a!forEach(items:{1,2,3}, expression:...) then it should be fine.
a!gridLayout( label:"program", headerCells: { a!forEach( items: {"230108","230109","230110"}, expression: a!localVariables( local!list: rule!GPO_questionDetails(questionID: fv!item), a!gridLayoutHeaderCell(label: local!list.label) ) ), if( not(rule!APN_isTrue(ri!isReadOnly)), a!gridLayoutHeaderCell(label: ""), {} ) } ),
btw this solves the issue too ;)
Thank you so much @Richard Michaelis. It is serving my requirement.