Hello,
How I can sort this by ClientName ?
Discussion posts and replies are publicly visible
Are you querying this from a database via a QueryEntity rule? If so, you can easily sort on a particular field via your a!pagingInfo() definition.
If it's data you have inherent or manually-created in an interface or a rule, then it takes a bit more work. Appian has no direct way to do this but a fairly easy indirect workaround, again involving pagingInfo.
a!localVariables( local!dictionary: { { clientId: 1, clientName: "z client 1" }, { clientId: 32, clientName: "a client name" }, { clientId: 58, clientName: "middle client" } }, todatasubset( local!dictionary, a!pagingInfo( startIndex: 1, batchSize: -1, sort: a!sortInfo( field: "clientName", ascending: true() ) ) ).data )
Hi Mike, I have tried this option but no luck, it shows error.
Expression evaluation error at function 'todatasubset' [line 42]: Cannot sort type {www.appian.com/.../2009}Dictionary by field clientName because it is a complex type {www.appian.com/.../2009}Variant. Sort by fields of primitive types only.
Can you enclose your "CXM_getClientName()" rule call on Line 39 within "toString()"? Depending on the output of that rule it could be evaluating to a somewhat weird data type.
Perfect! that worked.
Thank you!
great, thanks for confirming