Setting up basic variable logic in Invent

In this tutorial, we will look at Invent's ability to create variable logic.

This allows you to create and perform more complex and inteligent behaviour within your MegaEdit product. Variable Logic is essentially a collection of Rules, with each rule being made up of a series of Conditions and Actions. This article will run you through the high level process of creating some simple logic conditions and actions to demonstrate how this can be used in real life examples.

adobe

  1. 1. Understand the initial example setup

    Our initial Invent template is a simple setup consisting of functionality described in previous tutorials.

    This consists of:

    • 2 Resource Sets

      • 1 Colour Set with some defined brand colours

      • 1 Image Set with two logo options

    • 2 Variables

      • 1 dropdown controlling the Colour Set selection - visible on the form

      • 1 dropdown controlling the logo selection - not visible on the form

    • 2 image fields on the canvas

      • 1 with the background linked to the colour selection variable

      • 1 with the image linked to the logo variable.

    Our next step is to add some logic which changes the logo selection based on the background colour selected.

    Understand the initial example setup
  2. 2. Click Variables

    Click Variables

adobe

  1. 3. Click Setup Logic

    Click Setup Logic
  2. 4. On the logic screen, click Add Logic

    On the logic screen, click Add Logic
  3. 5. Logic pop up screen

    In order to use Variable Logic you need to start by creating a Rule.

    You need to specify a name for your Rule and optionally a description so you can explain what this specific rule is doing.

    Then each rule requires first a Condition (with a maximum of 10 assigned to a single Rule) and then an Action (with a maximum of 50 assigned to a single Rule) if that Condition is met.

    A single rule can have multiple else if statements, each containing their own Conditions and Actions so that if one Condition is not met, you can check for many more.

    You can also specify a 'catch all' else statement at the end of your Rule if you wish that has no Condition but only an Action and will always run IF no previous Conditions you have setup are met.

    When creating a Rule it needs contain at least one 'if' statement. Within that if statement you will configure your Conditions and Actions and if those Conditions are not met it will do nothing.

    What you can do though is setup multiple 'if' statements so that if one Condition is not met you can check for another and so on. In this situation you should create your first 'if' statement and then create subsequent 'else if' statements underneath.

    The order of these statements is important because the logic will first check the 'if' statement and only if that is not met, will it then check each of the following 'else if' statements until one returns true.

    Finally you can create an 'else' statement at the end that is used as a 'catch all'. This is there to ensure that the Rule you have setup with always do something even if all the Conditions you have created are not met. For the 'else' statement you do not create a Condition, only an Action as it will always run IF any of the previous 'if' and 'else if' statements have not been met (returned false).

    Logic pop up screen
  4. 6. Specify a logic statement name

    Specify a logic statement name

adobe

  1. 7. Click Add Condition

    Conditions are used in the Variable Logic Rules to determine when an Action should be triggered. A Condition can be set to run Always, Never OR based on a specific Variable. You can also include multiple Conditions within the same statement and set it up so that ALL conditions should be met, some conditions should be met or just one.

    When assigning a Condition to a Variable you can then create statements that will check that Variable if it contains, does not contain, is equal to etc. and then specify a value as the check criteria.

    Click Add Condition
  2. 8. Select the target of your condition

    This could be one of your existing variables, or can be an Always or Never condition.

    Select the target of your condition
  3. 9. In our example, we will select our background variable

    Once selected, additional options will appear allowing us to specify the state of that selection.

    In our example, we will select our background variable
  4. 10. Complete the condition

    In our example, our logic trigger condition will be:

    Logo Side Background | Equals | Navy

    So:

    Variable | Status | Variable Option

    Complete the condition
  5. 11. Click Add Action

    An Action is something that you want to happen when a Condition that you have setup is met. Actions can be assigned to both Variables and Fields and we support 3 types of action that can be assigned to a Variable or Field:

    • Set Value - You can specify a new value for that specific Variable or Field

    • Show - You can set that Variable or Field to be shown

    • Hide - You can set that Variable or Field to be hidden

    Click Add Action
  6. 12. Select the target of your action

    Select the target of your action
  7. 13. Select an Action's behaviour and result

    Select an Action's behaviour and result
  8. 14. Click Add else or Add else if to add alternative actions

    Click Add else or Add else if to add alternative actions

adobe

  1. 15. Click Add Action

    Click Add Action
  2. 16. Complete else action statements

    Complete else action statements

adobe

  1. 17. Review our logic and click Save

    So in our example, the specified logic will result in the following behaviour:

    If the background colour is set to Navy then we will show the white version of the logo.

    If the background colour is anything else, then we will show the colour version of the logo.

    To finish and confirm this logic, click Save.

    Review our logic and click Save
  2. 18. Export the MEX Invent template file

    Export the MEX Invent template file
  3. 19. Import your MEX file into your MegaEdit product

    See previous tutorials for further information on how to do this.

    Import your MEX file into your MegaEdit product

adobe

  1. 20. Launch your MegaEdit product editor

    Launch your MegaEdit product editor
  2. 21. Click the colour variable

    Your product will load in a default condition, with your variable(s) visible to the right of the screen.

    Click the colour variable

adobe

  1. 22. Select an alternate colour

    Select an alternate colour
  2. 23. The background colour will change, with the logic also causing the logo selection to update

    The background colour will change, with the logic also causing the logo selection to update