conventional method to find the gratest number using for loop
Discussion posts and replies are publicly visible
Hi romeoraja ,
Below one might be helpful.
a!localVariables( local!list: { 67, 80, 100, 102, 150 }, local!map: a!forEach( items: local!list, expression: a!map(number: fv!item) ), index( index( index( todatasubset( arrayToPage: local!map, pagingConfiguration: a!pagingInfo( startIndex: 1, batchSize: length(local!list), sort: a!sortInfo(field: "number", ascending: false) ) ), "data", {} ), "number", {} ), 1, {} ) )
A couple of suggestions:
a!localVariables( local!list: { 67, 80, 100, 102, 150 }, local!map: a!forEach( items: local!list, expression: a!map(number: fv!item) ), local!dataSubset: todatasubset( arrayToPage: local!map, pagingConfiguration: a!pagingInfo( startIndex: 1, batchSize: 1, sort: a!sortInfo(field: "number", ascending: false) ) ), cast( typeof(1), index(local!dataSubset.data, "number", null) ) )