Using Functions within Expressions

You can use functions within expressions in Document and Label Designer. The following are some examples:

Example of older method:

u"MYTEXT" + unicode(get_total_num_packed_containers_on_order(get_qs()))

Example of newer better method:

u"MYTEXT" + unicode(get_total_num_packed_containers_on_order(get_qs_list()))

The reason this is better is that some label types can have multiple querysets that should be passed into the function so get_qs might not be enough in some label templates.

Note: if your function has arguments you need to pass in you can do this as part of your expression:
u"MYTEXT" + unicode(get_total_num_packed_containers_on_order(get_qs_list(),
        args="MY_ARGS_GO_HERE"))

An example of passing actual arguments would be:

facility_time(get_qs_list(), args="d/%m/%Y - %H:%M")