Hi.
I am attempting to make a reusable grid using a passed ri! of type Any with a cdt type being passed into it.
Optionally I am thinking about passing in a list of column names so I can specify the order the grid displays columns in.
From there I wanted to do a foreach generating the N grid columns using field names and types grabbed from the passed cdt..
1.I don't know if there is a way to get a list of all the fields a cdt type has.
2. I am unsure if there is a way to get their types.
Any tips?
Discussion posts and replies are publicly visible
Peter Lewis said:The keys function should work on a dictionary.
I was able to reproduce Robert's issue actually. If I take a query entity which I already know to return a single known row, and wrap it in a!keys(), i get the pink error "The passed parameter(s) are of the wrong type. Received the type Any Type." I.e. from this:
a!keys(rule!APP_QRY_Person(personId: 87).data[1])
whereas, if i do the exact same query and same row, but cast the result as its type (or just as a!map), it works.
a!keys( cast( typeof( 'type!{urn:com:appian:types:APP}APP_Person'() ), rule!APP_QRY_Person(personId: 87).data[1] ) )
a!keys( cast( typeof( a!map() ), rule!APP_QRY_Person(personId: 87).data[1] ) )
Ah interesting, I guess the result of a query isn't truly a dictionary - it's actually just a list of variant. In that case I agree with your suggestion - probably casting to the map is safest.