I am creating a paging grid with selection that is based on a recordType! in my environment.
My interface is set up to follow the paradigm in https://docs.appian.com/suite/help/22.1/grid-with-selection-pattern.html#[line-1-54]-define-local-variables-and-grid-data but with the "data" parameter in the gridField obtained via recordType.
Code below:
a!localVariables( local!selection:index(ri!selectedStuff,"id",{}), local!selectedRows, /*this is what i need to populate*/ .. a!gridField( data:recordType!Foo, selectable:true, selectionValue:local!selection, selectionSaveInto:{ local!selection, a!save(local!selectedRows,append(local!selectedRows,fv!selectedRows)), a!save(local!selectedRows,difference(local!selectedRows,fv!deselectedRows)), a!save(ri!selectedStuff,local!selectedRows) } ) )
In my use case, I want to be able to pre-populate my local!selectedRows so that the grid can be pre-selected coming into the screen.
This is an entity-backed record, and passing a CDT array (of that entity) makes the page error on additional selection (why...it is an entity backed record and I am using the same entity)
I have also tried calling a queryrecordtype() to set local!selectedRows, but this also does not let me select/deselect.
How can I pre-populate the local!selectedRows with the record data I want to be selected?
Discussion posts and replies are publicly visible
fv!selectedRows is difficult to use, and "recordType!" style data is super difficult to use, and you're hitting an intersection between the two. Good luck, I guess.
Evan Rust said:passing a CDT array (of that entity) makes the page error
This is because CDT data and "recordType!" data is not cross-compatible. Not only that but there's no direct way to cross-cast it, and (as mentioned already) it's super convoluted to do *anything* with.
My suggestions would be to pick at least one of: a) make your grid QueryEntity based; and/or 2) make your GridSelections PKID based instead of "whole row of data" based.
I guess I'm going with Option 2. It's great that you can use the native features of the record grid here (search etc) but I really wish there was compatibility between record types + CDTs of that same entity. It would be nice to output the whole row instead of just the ID in case I need to access other fields in the row! Thanks both.