Hi
I have table with fields of school1, school2,school3......school10 and
value1,value2,value3,value4,value5.......value10 fields and
remark1,remark2,remark3....remark10
so I need to display school1 to school10 fields data under "schools" grid column as well as "values" fields and "remark" fields. as below format
Can any one suggest.
Regards,
Devi.
Discussion posts and replies are publicly visible
I suspect this won't be easy but should be doable with some on-form transformation work. Assuming the fields always start with the number "1" and iterate evenly through to "10" (though it could be more or less), you could use the property() function to manually pass in a field number and extract the matching property i.e. property(local!myQuery, "school" & fv!index), if you loop over an array containing the numbers 1 - 10, would give the subsequent field properties. You would use this to assemble a local dictionary/map containing the values ordered in a way that a!gridField() can make use of, and then you would just pass that local variable into the data: parameter.
Edit: here is a demonstration (in my case it's just 2 numbered columns per header "type", but it can easily be extended to more)...
a!localVariables( local!testQuery: { school1: "university of maryland", school2: "george mason", value1: "1234", value2: "5678", remark1: "Go Terps", remark2: "Bulldogs" }, local!numColumns: 2, local!transformedData: a!forEach( enumerate(local!numColumns), a!map( school: property(local!testQuery, "school" & fv!index), value: property(local!testQuery, "value" & fv!index), remark: property(local!testQuery, "remark" & fv!index) ) ), a!gridField( data: local!transformedData, columns: { a!gridColumn( label: "School", value: fv!row.school ), a!gridColumn( label: "Value", value: fv!row.value ), a!gridColumn( label: "Remark", value: fv!row.remark ) } ) )
Result:
Thanks a lot.