Skip to main content

Conditions PRO

Key name: Conditions
Element type: Dictionary
Status: Optional

Write here the conditions you want to reuse in other conditions in the plist. You can use user inputs variables or dynamic placeholders to specify those conditions.

Example

With UserRole as an input variable asked to the user, and the DEVICE_NAME dynamic placeholder. The ~= operand tests if the right operand is a prefix of the left operand.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- ... -->
<key>Conditions</key>
<dict>
<key>UserIsConsultant</key>
<string>UserRole == "Consultant"</string>
<key>ComputerIsLaptop</key>
<string>DEVICE_NAME ~= "LMAC"</string>
<key>ComputerIsDesktop</key>
<string>DEVICE_NAME ~= "DMAC"</string>
</dict>
<!-- ... -->
</dict>
</plist>

You can then use the conditions defined here in a TextComponent for example, without writing again all the condition:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- ... -->
<key>Slides</key>
<array>
<dict>
<key>Containers</key>
<array>
<dict>
<key>Components</key>
<array>
<dict>
<key>Type</key>
<string>Text</string>
<key>Condition</key>
<string>UserIsConsultant</string>
<key>Text</key>
<string>You are a consultant!</string>
</dict>
</array>
</dict>
</array>
</dict>
</array>
<!-- ... -->
</dict>
</plist>

The component will only appear when the condition is evaluated as true.