Instances¶
For each matched instance a variable with the identifier is created containing an Instance Wrapper object. This object has a list of methods available to access information and meta information about the matches instance.
[information_key]¶
For each information key a method is created to load that information value. For example if you have a Person with the information first_name and last_name then you can access them directly as properties with {{p.first_name}} and {{p.last_name}}.
get(information_key, sneaky=False)¶
Returns the value of the given information key. The optional sneaky parameter controls whether accessing this information marks it as necessary in the process — the same concept as the RuLa SNEAKY operator.
sneaky=False(default): accessing the value may cause the information to be requested from the user.sneaky=True: the value is accessed without making the information necessary.
<text>{{p.get('first_name')}}</text>
<text>{{p.get('first_name', sneaky=False)}}</text>
<text>{{p.get('first_name', sneaky=True)}}</text>
is_known(information_key, sneaky=False)¶
Returns True if the given information key has a known (non-unknown) value, False otherwise. The optional sneaky parameter works the same as for get(): when True, checking whether the value is known does not make the information necessary.
sneaky=False(default): may cause the information to be requested from the user.sneaky=True: checks the value without making the information necessary.
<text>{{p.is_known('first_name')}}</text>
<text>{{p.is_known('first_name', sneaky=False)}}</text>
<text>{{p.is_known('first_name', sneaky=True)}}</text>
<text>{{p.is_known('nonexistent_field', sneaky=True)}}</text>
Note that is_known is also available as a Jinja filter for use in filter pipelines.
translate(information_key)¶
Accessing information directly returns the value you would also get if you would access it with rula. For an enum value this means you would get e.g. de instead of Germany and for a unit value this means you get 55 instead of 55 kg. Using translate, you will get the value in the requested language of the document. You probably want to use translate(...) almost by default.
information_title(information_key)¶
Returns the translated title of the information_key. E.g First Name for information_title('first_name').
field_id(information_key)¶
Return the field_id for an information_key. This contains both the instance_id and the information_key. This is meant to be used with editable fields to provide a way to identify the field, for example like this:
<field
id="{{p.field_id('first_name')}}"
title="{{p.information_title('first_name')}}"
>
{{p.first_name}}
</field>
proof_file(proof_key)¶
Returns the path to the uploaded proof file to display proofs on ADX documents. This most likely is combined with an <image> tag, for example like this: