xforms-spec icon indicating copy to clipboard operation
xforms-spec copied to clipboard

Add function to remove duplicates from a list of values

Open lognaturel opened this issue 7 years ago • 4 comments

De-duplicating values can be helpful to do things like generating random numbers without duplicates as described in this mailing list thread.

SurveyCTO has shared implementations for several useful functions here including de-duplicate() which takes two strings as parameters: a delimiter and a string to de-duplicate. For example, passing in "," and "value1,value2,value1" gives "value1,value2" as its result.

XPath 2.0 defines a function called distinct-values which operates on a sequence.

It does not appear that Dimagi-xforms includes this functionality.

lognaturel avatar Dec 12 '16 13:12 lognaturel