Xmerge Quick Code – Better Multi coding

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
<:end:>

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
<:end:>

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
<:end:>

Remember

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

Conclusion

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.

Matthew Townsend
Xplan Consultant and Developer | Wealth Management Technologist at Create Something
Matthew is an experienced and innovative Xplan consultant and developer, having worked on and developed some of the largest advice projects in the industry. Passionate about building great experiences in xplan that enable businesses and clients to get the most out of this powerful software.

Matthew Townsend

Matthew is an experienced and innovative Xplan consultant and developer, having worked on and developed some of the largest advice projects in the industry. Passionate about building great experiences in xplan that enable businesses and clients to get the most out of this powerful software.

Leave a Reply

Your email address will not be published. Required fields are marked *