Preparing Data for Use with lfRestrictSelectOptions()

Sometimes it makes sense to use lfRestrictSelectOptions() rather than lfAllowSelectOptions(), but the arrays you want to use are not easy to parse when using lfRestrictSelectOptions().

Solution

By using arrayDiff(), the challenge of preparing the data for lfRestrictSelectOptions() is made easy. Consider the script below with a list of elements found in "fullArray". In the "allow" array, these are custom field options I wish the user to see. When arrayDiff() is used, this returns all the options which would be removed by lfRestrictSelectOptions().

string [] fullArray = "allow1|remove1|allow2|remove2|allow3|remove3"; string [] allow = "allow1|allow2|allow3"; string [] restrict = arrayDiff(fullArray, allow);   runnerLog(restrict);

This returns the following in the SIL Manager console:

remove1|remove2|remove3

 

Here is the documentation for arrayDiff().

lfRestrictSelectOptions()

lfAllowSelectOptions()

Additional Help

Need help implementing this script? Talk to me directly to me by clicking on the bot on this page.

Related articles

Filter by label

There are no items with the selected labels at this time.