Rememebr you can reverse the sorting (oldest to youngest) by adding ‘-‘ in front of age like (‘-age’)
Using the Entity ID
There are numerous groups and data points in Xplan where you will be presented with the ability to select a client. This is effectively linking an actual client in Xplan to a particular record, in the case of dependants this can come up because the children might also be clients of the advisers.
You can use this link to extract any further detail about the entity using the syntax described here.
<:for item in $client.dependent:>
Joining dependants in a sentence
In various outputs, some clients may wish to show all of a clients dependants names in a sentence style structure, for example: “Your dependants are: John, Jane and Dave-o”. When doing this it means you need a mechanism to determine the number of dependants and their position so that you can include the sentence case such as commas and an ‘and’ before the final name.
To achieve this, you can use the following xplan code:
<:let depList= [str(x.dep_name) for x in $client.dependent]:>
<:=len(depList)> 1 and (‘ and ’.join([‘, ’.join(depList[:-1])] + depList[-1:])) or ‘’.join(depList):>