ProcessValues(list;expression)

Idea created by Vincent_L on Aug 20, 2017
    Active
    Score3
    • jbante
    • hehazelhorst
    • Vincent_L

    Hi,

     

    Due to the very common need to process a list of values, there's in tons of solutions out there :

     

    There's countless recursive custom function created just to process each values of a Value list.

    But their recursive call count is limited, therefore limiting the number of values to be processes,and they can use a lot of memory

     

    There's also countless scripts, written just to process each values of a Value list to avoid, value count limitation.

    But, unfortunately those scripts are not as useful as functions.

    Moreover, if there's a huge number of values, those script become more and more slower "quadratically" (see here  : https://community.filemaker.com/ideas/1875#comment-13764))

     

    All those complex (recursion is hard to master, and is a bit of hammer to kill a fly, and not very filemakerish), limited, and inefficient code represent a lot of dev hours to reinvent the same wheel. So that's time for Filemaker to live up its simplicity mantra and deliver a tool that will help lots of people.

     

    The proposed function, would be very easy to implement for FMI, easy to understand, and deliver great speed gains

     

    ProcessValues(list;expression)

     

    - list : a value list (return delimited of course)

    - expression : a string that will be evaluated internally with the evaluate function.

     

    So this function, would loop though all the values of list, put each value content in a let like variable whose name would be value, and evaluate the expression (with the "value" string replaced by the current value contents).

     

    Speed would be faster just because, internally it would be a for each loop, that would not need to pass each time the whole list

    Moreover it would be finite, so no risk of infinite looping.

     

    Speed should be even improved by only interpreting the evaluation once, and then apply it for each record.

    But, it could be smarter than that. It would look in the expression if there's $ or $$ variables, and if so, would not re-interpret for each value (because using $/$$ variables in those expression could be handy in that context to pass to a row, the value of the previous one for instance.

     

    P.S : Yes I'm aware about Agnes' excellent custom values. But a native way will be faster, unlimited, and more importantly easy to discover for people and will contribute to the ease of use of filemaker.