skip to Main Content

Xplan Quick Xplain

Conditioning multi fields – in a way you might remember

Conditioning for Multi fields

This Xmerge Quick Xplain looks at an easier way to code your conditioned multi fields.

Chances are, either from using the XWord toolbar, watching IRESS Training videos or extrapolating what you can from templates, you recognise that the code below is the standard format for conditioning multi fields:

<:if filter(lambda x: x in ['1'], map(str,$client.valueOf('scope_of_my_advice'))):>
Do something

In the above code, if the value equivalent of ‘1’ is ticked against this client then the condition will be true and consequently it will ‘do something’.

So whats the problem?

There is no problem, the above works no worries but the issue is that remembering the above coding gives people who have worked with xplan for years pause, just remembering it – let alone if they get it right.

Essentially its main issue is: too lengthy and to properly understand the coding (required for optimal recall and adaption) the person needs to understand several concepts and how they work together: filter, lambda and map. 

What’s a better way then?

The same code could simply be written as:

<:if '1' in $client.scope_of_my_advice:>
Do something

What about if you are conditioning off more than 1 item in the multi?

<:if ['1','3'] in $client.scope_of_my_advice:>
Item equal to value 1 and or value 3 found...yep time to do something


In both instances we’re working with the value of the data in the multi field not the text.  As illustrated below

Xplan Xmerge Coding
Xplan Xmerge Coding


let us know how you go with this approach and if you find this easier to remember off the top of your head than the standard way.

Back To Top