Hi,
I have an interface that contains a Grid based on a RecordType. So the latter can be filtered as need the users.
After being filtered, how may I get the datasubset of this RecordType ?
For example, on a 200 rows table, if the filtered RecordType displays only 5 rows, I need these 5 rows to be retrieved in my datasubset.
I need to work with this datasubset at anytime.
Discussion posts and replies are publicly visible
Just curious - why do you need the datasubset of the data from the grid? Are you selecting this data for a form, or displaying something else on the interface, etc?
Peter, my RecordType grid is in a sub interface. So yes, these data are needed by the parent interface to get the CDT list.After some actions these data are sent to the initial process model to update some data in DB.
I guess my question is - can you use the options for selection to return the selected values to the parent interface? Usually it isn't as good a user experience to directly choose all the rows from the grid just based on the filters. I usually prefer having the user select the filters and then have them also select the rows they should use. If you use this paradigm, then you can just use the selection parameter in the grid to save into a variable that can be used in your parent interface.
Currently, yes, I use the selection IDs.Then in my parent interface, I use an expression rule to get the data, and get the rows data from the IDs selection (with the index() function).In place of using this expression rule, I would prefer to get the data directly from the RecordType.
Peter,I can not use the selection parameter as I need to use a Rule Input to store my selection objects.
This discussion below shows an error I met on Appian when I use a RI to store grid selection objects, maybe have you an idea to avoid this error? :-)
community.appian.com/.../77175
Can you set the rule input to be of type "Any Type" instead?
Good idea,Yes, it works fine, but then I have to use AnyType everywhere.If in my parent interface, I try to cast AnyType RI to my CDT RI it throws an error.I think it can do the job, but I would prefer to work with a CDT RI array over an AnyType RI array.Can you tell me where I can find the source code of the "difference" function... the error always happends in this function.
Ok if you want to ensure the type matches, you should be able to set this up by adding the casting on the append as well as the difference. Also, make sure you use the list type to cast it correctly:
selectionSaveInto: { local!selection, a!save( ri!case, append( ri!case, cast( 'type!{urn:com:appian:types:PDL}PDL_Client?list', fv!selectedRows ) ) ), a!save( ri!case, difference( ri!case, cast( 'type!{urn:com:appian:types:PDL}PDL_Client?list', fv!deselectedRows ) ) ) }
Thanks a lot Peter, that works very well now.In all tests I've made, the only I did not think to do is to add "?list" when casting...Great ! :-)
Nice! There's also one other way to set it up if you need a list (if you're on 20.3 or later). There is a new function called a!listType() which will cast any type to a list without needing to add "?list" to the end.
selectionSaveInto: { local!selection, a!save( ri!case, append( ri!case, cast( a!listType('type!{urn:com:appian:types:PDL}PDL_Client'), fv!selectedRows ) ) ), a!save( ri!case, difference( ri!case, cast( a!listType('type!{urn:com:appian:types:PDL}PDL_Client'), fv!deselectedRows ) ) ) }
Thank you Peter, I keep this on hand :-)
As my initial question was "How to get data from a filtered RecordType", how would you get the number of records of this RecordType ?I do not have access to the subdataset.totalCount attribute.
local!data : a!recordData( recordType: recordType!R_MyContracts, filters: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: recordType!R_MyContracts.fields.status, operator: "=", value: "OK" ), }, ignoreFiltersWithEmptyValues: true ) ),