skip to Main Content

xplan xmerge

Search
Generic filters
Exact matches only
Filter by Custom Post Type

Try these: client detailstasks syntaxsuperannuation

Function: Entity Names

This collection of functions in general just makes life easier, while cutting down repetition, error and adding redundancy.

Defining the functions

Recommend you define this function at the start of your template so that you can call it throughout the template as needed.

Full Name

This function will output the first and last name of an entity.  Where the entity isn’t an individual it will output the entity name instead.

Setec Astronomy

<:let getFullName= lambda x: str(x.first_name)+’ ‘+str(x.last_name) if x.is_individual else str(x.superfund_name) if x.is_superfund else str(x.trust_name) if x.is_trust else str(x.company_name) if x.is_company else str(x.partnership_name) if x.is_partnership else str(x.entity_name):>

Preferred Name

This function outputs an entities preferred name, but where a preferred name isn’t recorded it reverts to the first name.  If the entity is a non individual it will fall back to entity name.

Setec Astronomy

<:let getName=lambda x: str(x.preferred_name) if x.is_individual and x.preferred_name else str(x.first_name) if x.is_individual else str(x.entity_name):>

Owner Name

This function is useful for dealing with group data where often the information is recorded against one entity and an owner like field is used to differentiate who the record belongs to.  Commonly this might be assets and liabilities, income and expenses, strategy groups etc.

Setec Astronomy

<:let getOwnerName=lambda x: getName($client) if str(x)==’Client’ else getName($client.marriage_partner) if str(x)==’Partner’ else str(‘Joint’) if str(x)==’Joint’ else ‘None’:>

Example usage

Setec Astronomy

<:=getFullName($client):>
output: John Smith

<:=getName($partner):>
output: Betsie

Notes

These functions are universal and will work with any client entity type in xplan.  This means you can use this for the advisers name, the users name, professional advisers etc:

Adviser and user

Setec Astronomy

<:=getFullName($client.client_adviser):>
output: Demo Adviser
<:=getFullName($user):>
output: Matthew Townsend

Professional Adviser (through entityid)

Setec Astronomy

<:for adviser in $client.prof_advisers:>
<:=getName($entity(int(adviser.entity_id))):>
<:end:>

See also

Back To Top