Lets say I have a CDT of 5 Fields that get populated. I'd like to create a grid that displays both the field name and the value. (A graphical representation of the CDT if you like).i.eTEST CDT
FieldA Value1FieldB Value2FieldC Value3FieldD Value4FieldE Value5
I know that in the forEach loop I can access fv!item to get the value, but I'm not sure there's anything to get me the field names ??
Discussion posts and replies are publicly visible
Hi Paul,
I believe the below code example will return exactly what you're looking for. Just match the type!MyCDT() with the type from your input and give your input some data
= load( local!CDTFields: split( stripwith( tostring( 'type!MyCDT'() ), "=[] " ), "," ), { a!paragraphField( value: local!CDTFields ), a!gridField( totalCount: length( ri!CDT ), columns: a!forEach( items: local!CDTFields, expression: a!gridTextColumn( label: fv!item, field: fv!item, data: index( ri!CDT, fv!item, null ) ) ), value: a!pagingInfo( startIndex: 1, batchSize: - 1 ) ) } )
Hi pauls0003
Try out the below code, it will help you.
load( local!extractFieldsFromCDTExceptField1:trim(extract(tostring(ri!myType),",","=")), local!extractField1FromCDT:replace(extract(","&tostring(ri!myType),",","=").[1],1,1,""), append( {}, local!extractField1FromCDT, local!extractFieldsFromCDTExceptField1 ) ) /*Here make ri!myType of type Any Type*/