I need the ability to sort an array of a Record Type similar to how for an array of dictionaries or CDTs you can use a!dataSubset() with the correct paging info. I tried that with an array of record type and with the correct paging info using the record syntax. It did not error out when called like todatasubset(). It just returned exactly what I passed in.
Requerying the the database using a!queryRecordType() is not an option. Until a form is submitted, I have to continue manipulating what's in local variables. Because of the sheer size of the input fields and the quantities of fields, I can not use either a!gridField() or a!gridLayout(). I am looping through using a!forEach() in a card layout. Removing and re-inserting back into the array is what I am doing for certain user sort functionality. But, it's more efficient to then resort for all the remainder sub and sub-sub elements in the array.
I prefer not having to cast it to an array of CDT, sort, then recast it back to an array of record type. That just seems very inefficient. But, if Appian doesn't support the feature I need, and not anytime soon, then looks like I don't have any choice.
Any help is greatly appreciated.
Thanks.
- Brian
Discussion posts and replies are publicly visible
briank0009 said: similar to how for an array of dictionaries or CDTs you can use a!dataSubset()
a!dataSubset() do not perform any type of sorting, it just convert the inputs provided into the type DataSubset which is often useful when using pickerFIeldCustom.
While todataSubset() not working for recordType list is a bug that they are planning to fix in future releases (not sure if it is fixed in 23.1), so I assume the only option you are left with as of now is to cast to a Map, sort, and then cast back to RecordType since you don't want to query your recordType again.
There was a similar thread like this a few months back, will drop it here if I find that.
edit: Similar thread - https://community.appian.com/discussions/f/data/27788/sorting-record-dataset
Hi briank0009
Please find below added code for more reference.
a!queryRecordType( /*recordType: Record Type Name*/ recordType: 'recordType!{34ffdc21-a570-4826-9943-4808b00b2b80}LR Practice', fields: {}, pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 3000, sort: { a!sortInfo( /*field: Needs to add Primry key column or unique constrain column*/ field: 'recordType!{34ffdc21-a570-4826-9943-4808b00b2b80}LR Practice.fields.{36bf5a17-b5f0-480b-a851-1a699d67c277}id', ascending: false ) } ) ).data