Last updated: 11.06.2024
Valid from: Opter 2024.06.00, Opter Driver for iOS and Opter Driver Labs for Android 2.4.3
Conditions in App.OpterDriver.Design
Conditions are used to display a certain text in the app based on whether there is certain info in the order, for example "show sender's phone number if it is stated on the order". If it is not there, nothing will be displayed in the app. This makes it possible to avoid displaying empty fields in the app that might cause confusion, for example "Telephone:" .
Examples of how terms are used in their particular context can be found in the default design in A complete example of App.OpterDriver.Design for 2023.12-01.00 and later. In this article, we look at more specific examples.
Syntax
To set a condition, use the condition attribute in the item tag. Often you want to display the information in the app if it is on the order. This means that the same tag is usually used for the condition and the information to be displayed, combined with an explanatory text. Such as ENTRECODE and PACKAGECOUNT in the examples below.
Example 1: Display the text "Entry code:<xxxx>"if the entry code of the sender address is stated on the order. $Design_PortCode retrieves the text "Entry code" (see Text tags in App.OpterDriver.Design).
Example 1
<row>
<item itemname="'$Design_PortCode',': ',ENTRECODEFROM" condition="ENTRECODEFROM != " width="100"/>
</row>
Example 2: Display the text "Number of packages:<xx>"if there is at least one package on the order. $Design_PackageCount retrieves the text "Number of packages" (see Text tags in App.OpterDriver.Design).
Example 2
<row>
<item itemname="'$Design_PackageCount',': ',PACKAGECOUNT" condition="PACKAGECOUNT > 0" width="100" font="LARGEBOLD" />
</row>
Multiple conditions on the same row
You can have one or more conditions on the same row. "+" (plus sign) and "," (comma) mean "and", and "|" (vertical bar) means "or".
-
Row 2: Display the text "Note: Check the options on the order" if the order has any of the options with the codes "V" and "L". DELIVERYOPTIONS is a list of option codes.
-
Row 5: Display the text "Options: refrigeration and sack truck" if the order has the options "Refrigeration" and "Sack truck". DELIVERYOPTIONNAMES is a list of option names.
DELIVERYOPTIONS and DELIVERYOPTIONNAMES are lists of option codes and option names. They cannot be used as tags to display the code or name of the option in the app. Thus, if the condition is "or", as in row 2 of the example below, it is not possible to know which of the options is on the order, or if they are both on it, when the text is printed.
<row>
<item itemname="'Note: Check the options on the order'" condition="DELIVERYOPTIONS : V | DELIVERYOPTIONS : L " />
</row>
<row>
<item itemname="'Options: refrigeration and sack truck'" condition="DELIVERYOPTIONNAMES : Refrigeration , DELIVERYOPTIONNAMES : Sack truck " />
</row>
Conditions for different types of data
There are four different types of data on the orders that can be used as conditions:
-
Numerical values (e.g. if the order has a specific number).
-
Time (e.g. if there is a latest delivery time stated on the order).
-
Text in a field (e.g. if the customer reference contains “John”).
-
Settings on/off (e.g. if Allow delivery even if not at home is selected/deselected on the order).
As App.OpterDriver.Design is an XML file, the characters "<" and ">" must be written as < and > in the conditions. It is not possible to use "<" and ">".
Conditions for numerical values and time
Conditions | Meaning | Written in App.OpterDriver.Design |
---|---|---|
!= |
Not equal to. Also used to show any value by not specifying a value for the condition. condition="ORDERID != " means "display the text regardless of what the order number is" (the order number is "not equal to nothing", i.e. "equal to anything"). See the first example below (row 2). |
!= |
= |
Equal to. |
= |
> |
Greater than. |
> |
< | Less than. | < |
>= |
Greater than or equal to. |
>= |
<= |
Less than or equal to. |
<= |
Example 4: Displays the text "Order number:<order number>"depending on what the order number is. $Design_OrderNumber retrieves the text "Order number" (see Text tags in App.OpterDriver.Design).
-
Row 2: Always displays the text no matter what the order number is. The condition “not equal to” followed by none is used in the condition.
-
Row 5: Displays the text if the order number is not 116. If the order number is 116, no text at all is displayed.
-
Row 8: Displays the text if the order number is exactly 116. If the order number is something other than 116, no text at all is displayed.
-
Row 11: Displays the text if the order number is greater than 116. If the order number is 1–116, no text at all is displayed.
-
Row 14: Displays the text if the order number is less than 116. If the order number is 116 or higher, no text at all is displayed.
-
Row 17: Displays the text if the order number is 116 or more. If the order number is 1–115, no text at all is displayed.
-
Row 20: Displays the text if the order number is 116 or less. If the order number is 117 or higher, no text at all is displayed.
<row>
<item itemname="'$Design_OrderNumber',': ',ORDERID" condition="ORDERID != " />
</row>
<row>
<item itemname="'$Design_OrderNumber',': ',ORDERID" condition="ORDERID != 116" />
</row>
<row>
<item itemname="'$Design_OrderNumber',': ',ORDERID" condition="ORDERID = 116" />
</row>
<row>
<item itemname="'$Design_OrderNumber',': ',ORDERID" condition="ORDERID > 116" />
</row>
<row>
<item itemname="'$Design_OrderNumber',': ',ORDERID" condition="ORDERID < 116" />
</row>
<row>
<item itemname="'$Design_OrderNumber',': ',ORDERID" condition="ORDERID >= 116" />
</row>
<row>
<item itemname="'$Design_OrderNumber',': ',ORDERID" condition="ORDERID <= 116" />
</row>
Example 5: Displays the text Delivery time (latest):<date and/or time> depending on the details on the order. There are corresponding tags for the earliest pickup time, for example EARLIESTPICKUPTIME and EARLIESTPICKUPDATE. $Design_Delivery retrieves the text "Delivery" (see Text tags in App.OpterDriver.Design).
-
Row 2: Displays the text if the latest delivery date or latest delivery time are on the order. If both are on it, they are both displayed, with a space between them.
-
Row 5: Displays the text if the latest delivery time is 12.01 or later. If the latest delivery time is 12.00 or earlier, no text at all is displayed.
-
Row 8: Displays the text if the latest delivery time is 11.59 or earlier. If the latest delivery time is 12.00 or later, no text at all is displayed.
-
Row 11: Displays the text if the latest delivery time is 12.00 or later. If the latest delivery time is 11.59 or earlier, no text at all is displayed.
-
Row 14: Displays the text if the latest delivery time is 12.00 or earlier. If the latest delivery time is 12.01 or later, no text at all is displayed.
-
Row 17: Displays the text if there is an estimated delivery date or estimated delivery time on the order.
<row>
<item itemname="'$Design_Delivery',': ',LATESTDELIVERYDATE,' ',LATESTDELIVERYTIME" condition="LATESTDELIVERYDATE != | LATESTDELIVERYTIME != " />
</row>
<row>
<item itemname="'$Design_Delivery',': ',LATESTDELIVERYTIME" condition="LATESTDELIVERYTIME > 12:00" />
</row>
<row>
<item itemname="'$Design_Delivery',': ',LATESTDELIVERYTIME" condition="LATESTDELIVERYTIME < 12:00" />
</row>
<row>
<item itemname="'$Design_Delivery',': ',LATESTDELIVERYTIME" condition="LATESTDELIVERYTIME >= 12:00" />
</row>
<row>
<item itemname="'$Design_Delivery',': ',LATESTDELIVERYTIME" condition="LATESTDELIVERYTIME <= 12:00" />
</row>
<row>
<item itemname="'$Design_Delivery',': ',ESTIMATEDDELIVERYDATE,' ',ESTIMATEDDELIVERYTIME" condition="ESTIMATEDDELIVERYDATE != | ESTIMATEDDELIVERYTIME != " />
</row>
Conditions for text
Conditions | Meaning | Written in App.OpterDriver.Design |
---|---|---|
!= |
Not equal to. Also used to show any value by not specifying a value for the condition. condition="ORDERID != " means "display the text regardless of what the order number is" (the order number is "not equal to nothing", i.e. "equal to anything"). See the first example below (row 2). |
!= |
= |
Equal to. |
= |
: |
Includes. |
: |
Example 6: Displays the text "Customer contact:<name>"depending on the customer reference name. $Design_CustomerContact retrieves the text "Customer contact" (see Text tags in App.OpterDriver.Design).
-
Row 2: Always displays the text if there is a customer reference on the order. The condition “not equal to” followed by none is used in the condition.
-
Row 5: Only displays the text if the customer reference name is "John Stattin"
-
Row 8: Displays the text if the customer reference name includes the text "john". The text is also displayed if the surname contains "john", for example "Brian Johnson". The condition is not case-sensitive. The full name is printed in the app, not just the part that matches the condition.
<row>
<item itemname="'$Design_CustomerContact',':',CUSTOMERREFERENCE" condition="CUSTOMERREFERENCE != " />
</row>
<row>
<item itemname=="'$Design_CustomerContact',':',CUSTOMERREFERENCE" condition="CUSTOMERREFERENCE = John Stattin" />
</row>
<row>
<item itemname=="'$Design_CustomerContact',':',CUSTOMERREFERENCE" condition="CUSTOMERREFERENCE : John" />
</row>
Conditions for settings on/off
Conditions | Meaning | Written in App.OpterDriver.Design |
---|---|---|
true |
On |
true |
false |
Off |
false |
Example 7: Displays different texts depending on whether the Allow delivery even if not at home checkbox is selected or deselected on the order.
-
Row 2: Displays the text "Leave at the door if nobody is home" if Allow delivery even if not at home is selected on the order.
-
Row 5: Displays the text "Return to terminal if nobody is home" if Allow delivery even if not at home is not selected on the order.
<row>
<item itemname="'Leave at the door if nobody is home'" condition="ALLOWDELIVERYNOTHOME = true" />
</row>
<row>
<item itemname="'Return to the terminal if nobody is home'" condition="ALLOWDELIVERYNOTHOME = false" />
</row>