Expression for sorting a list equivalent to OrderBy and ThenBy equivalent of C#

Hi,

I am facing one challenge to sort a list of addresses into particular order. The appian sail expression should match the sorting order as in our C# equivalent using orderby and thenby. My SAIL expression is not giving same results as C# code(Expected one).Kindly provide suggestions.

in c#:

sortedAddresses.AddRange(addresesList.Where(x => x.AddressId != primaryAddress.AddressId).OrderByDescending(o => o.EndDate).ThenByDescending(o => o.EffectiveDate).ThenBy(o => o.AddressType.Name).ThenByDescending(o => o.IsActive).ToList());

in SAIL:

todatasubset(
todatasubset(
todatasubset(
todatasubset(
remove(
local!7sortedaddresses,
wherecontains(
touniformstring(local!primaryAddress.addressId),
touniformstring(property(local!data, "addressId", ""))
)
),
a!pagingInfo(
startIndex: 1,
batchSize: - 1,
sort: a!sortInfo(field: "endDate", ascending: false())
)
).data,
a!pagingInfo(
startIndex: 1,
batchSize: - 1,
sort: a!sortInfo(
field: "effectiveDate",
ascending: false()
)
)
).data,
a!pagingInfo(
startIndex: 1,
batchSize: - 1,
sort: a!sortInfo(field: "addressType", ascending: true())
)
).data,
a!pagingInfo(
startIndex: 1,
batchSize: - 1,
sort: a!sortInfo(field: "isActive", ascending: false())
)
).data

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data