Does anyone have alternatives (internal or plugin) to the internal functions eval() and sort()?
It has been indicated in previous posts that these functions are hidden functions and are not for general use. We wish to avoid using these as they could be modified or removed at any point for future versions.
Discussion posts and replies are publicly visible
I don't know of any replacement for eval(). There probably isn't one.
for sorting, though, topaginginfo() can be used to sort arbitrary data in a batch on demand -- appian even had at least one common object for this. Here is APN_sortComplexTypes:
=with( local!ascending: rule!APN_replaceNull(ri!ascending, false()), if( rule!APN_isBlank(ri!field), todatasubset(ri!cdt, fn!topaginginfo(1,-1)).data, todatasubset(ri!cdt, rule!APN_pagingInfo1Sort(field: ri!field, ascending: local!ascending)).data ) )
If you have a limited number of functions that you're using inside eval(), then an option would be to create an expression rule that chooses between them. The rule would take in two inputs, a string to indicate which function to choose, and a dictionary of inputs to pass into the function. This is what the rule could look like: choose( wherecontains(ri!function, {"sum", "floor", "concat"}), sum(ri!inputs), floor(number: index(ri!inputs, "number", {}), significance: index(ri!inputs, "significance", {})), concat(ri!inputs) ) Then you would call rule!evaluate(function: "floor", inputs: {number: 15.5, significance: 1})