skip to Main Content

xplan xmerge

Search
Generic filters
Exact matches only
Filter by Custom Post Type

Try these: client detailstasks syntaxsuperannuation

Function: join list

This custom function takes a list of items and formats into sentence case with appropriate comma’s and ‘and’ at the end.

Defining the function

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

Setec Astronomy

<:let joinList=lambda x: len(x)>1 and (‘ and ’.join([‘, ’.join(x[:-1])] + x[-1:])) or ‘’.join(x[0]):>

Example usage

Setec Astronomy

<:=joinList([str(x.dep_name) for x in $client.dependent]):>
output: John, Jenny and Bill

See also

Back To Top