Show details for Boolean Variables | IV_013

Boolean Variables | IV_013

In this tutorial, we will learn how to utilise the Boolean variable type. This variable allows for a true or false value, and has a number of uses. In our example, we will see how we can link our Boolean Variable to another variable, in order to show or hide it.

Tutorial Video Transcript

00:00:12:16 - 00:00:12:27
And this

00:00:12:27 - 00:00:16:15
tutorial will learn
how to utilize the boolean variable type.

00:00:17:04 - 00:00:20:03
This variable allows for a true
or false value

00:00:20:03 - 00:00:23:11
to be returned
and has a number of potential uses

00:00:23:20 - 00:00:27:22
such as showing it
hiding fields on a template itself

00:00:28:08 - 00:00:33:08
or potentially showing in hiding variable
within our form, for example.

00:00:33:23 - 00:00:38:13
So to begin, we're going to navigate to
our variables tab within the Invent plugin

00:00:39:17 - 00:00:42:19
and click on Add new variable.

00:00:48:06 - 00:00:51:01
Now there's a few different variable types
that we can choose from.

00:00:51:11 - 00:00:55:28
In this case,
we're going to go for a Boolean variable.

00:00:57:21 - 00:00:59:27
The setup of this one is quite simple.

00:00:59:27 - 00:01:04:21
We just need to enter a name and specify
whether the default state of that

00:01:04:21 - 00:01:09:22
boolean is true or false.

00:01:11:20 - 00:01:13:21
Well,
I might say that my default state is true

00:01:16:09 - 00:01:18:07
and then click save

00:01:24:08 - 00:01:26:07
to link to our boolean variable

00:01:26:07 - 00:01:29:02
so that it controls the visibility
of another variable.

00:01:29:19 - 00:01:33:09
We're going to click edit on the variable
that we want to be controlled.

00:01:33:26 - 00:01:35:13
So in the example I avoided up here,

00:01:35:13 - 00:01:38:22
we only have one other variable
that would be visible on the form.

00:01:39:09 - 00:01:45:08
If I go to edit,
you'll see that right underneath

00:01:45:08 - 00:01:48:00
where we enter the name
and we have the type of variable.

00:01:48:09 - 00:01:51:28
We also have the ability
to enable a parent variable.

00:01:53:14 - 00:01:54:27
This gives us a list of

00:01:57:01 - 00:01:58:23
associated variables that

00:01:58:23 - 00:02:01:11
we can link with this one
as a parent variable,

00:02:01:24 - 00:02:04:24
and we can control
what happens to the current variable

00:02:05:02 - 00:02:07:21
based on the condition
of the parent variable.

00:02:09:04 - 00:02:12:12
So for example,
we can say condition to show this variable

00:02:13:25 - 00:02:15:07
is true.

00:02:15:07 - 00:02:19:06
So basically when the parent variable
is listed as true,

00:02:19:14 - 00:02:22:24
then this variable
will currently entering editing.

00:02:22:24 - 00:02:25:09
So the address is variable will show

00:02:27:18 - 00:02:31:24
and then save.

00:02:31:24 - 00:02:36:09
Now another thing we might want to test
with our boolean variable

00:02:36:19 - 00:02:38:28
is the ability to show or hide

00:02:40:04 - 00:02:42:23
entries on the template itself.

00:02:42:23 - 00:02:47:24
So as an example of this,
let's say that we want to hide the title

00:02:47:24 - 00:02:50:10
field here.

00:02:52:02 - 00:02:54:23
First thing is
we need to make sure that this is enabled

00:02:54:23 - 00:02:56:05
so that we're actually able to

00:02:57:10 - 00:02:59:06
modify this

00:02:59:06 - 00:03:01:16
field dynamically.

00:03:01:22 - 00:03:05:02
And then we're going to go back
to our variables tab and set up

00:03:05:02 - 00:03:08:19
some logic.

00:03:08:19 - 00:03:10:27
So logic we've seen in one previous video,

00:03:11:22 - 00:03:14:22
we'll do a very similar process here

00:03:14:22 - 00:03:18:19
where I'm going to add a logic statement

00:03:24:20 - 00:03:26:28
and then define a condition and an action.

00:03:28:00 - 00:03:29:15
So my condition would be
that if the

00:03:29:15 - 00:03:34:02
if the Boolean value is not selected,
then the resulting action

00:03:34:02 - 00:03:35:19
if the Boolean value is not selected,
then the resulting action

00:03:36:19 - 00:03:40:16
would be the one of those fields

00:03:41:00 - 00:03:42:17
would be hidden.

00:03:42:17 - 00:03:46:13
So I can select the field of interest
and then change the state

00:03:47:11 - 00:03:51:05
based on this show and hide.

00:03:51:05 - 00:03:55:06
And then just to complete that
statement will make an all statement where

00:03:55:06 - 00:03:59:13
if the boolean value is anything
but not selected,

00:04:00:03 - 00:04:04:14
then we'll show that field.

00:04:06:27 - 00:04:08:21
So there's two example sets of there.

00:04:08:21 - 00:04:11:25
Let's export this template as a MEX file

00:04:12:07 - 00:04:14:25
and imported into our MegaEdit template

00:04:15:12 - 00:04:17:24
so that we can
actually see this in action.

00:04:17:24 - 00:04:21:06
So with this template now loaded,
we can test that behavior.

00:04:21:22 - 00:04:24:28
Now, remember,
there was two things that we linked to

00:04:25:12 - 00:04:27:26
this particular Boolean variable.

00:04:28:25 - 00:04:31:19
Both of them were showing and hiding.

00:04:31:19 - 00:04:36:07
When this is set to true,
we see both the address variable

00:04:36:11 - 00:04:40:09
and we see the title field
within the document itself.

00:04:41:04 - 00:04:46:10
However, if I deselect that option,
we can see the variable disappears

00:04:46:18 - 00:04:48:17
along with

00:04:49:12 - 00:04:50:19
the text frame

00:04:50:19 - 00:04:53:10
itself.

 

Incomplete
Step by Step Guide

Boolean Variables

In this tutorial, we will learn how to utilise the Boolean variable type.

This variable allows for a true or false value, and has a number of uses.

In our example, we will see how we can link our Boolean Variable to another variable, in order to show or hide it.

Creation Date: Jan 20, 2023
Created By: Sam Webster

1. To begin, navigate to the Variables tab in the Invent plugin and click Add Variable

To begin, navigate to the Variables tab in the Invent plugin and click Add Variable

2. Select a Boolean Variable

Select a Boolean Variable

3. Enter a variable name and select the variable default value

In our example, we will be using our Boolean Variable to show or hide a dropdown variable containing address options.

The Default value will control whether this variable is checked (TRUE) or unchecked (FALSE) by default.

Enter a variable name and select the variable default value

4. Click Save to confirm the variable

Click Save to confirm the variable

5. To link our Boolean Variable so that it controls the visibility of another variable, click Edit on the variable to be controlled

To link our Boolean Variable so that it controls the visibility of another variable, click Edit on the variable to be controlled

6. Click Enable Parent Variable

Click Enable Parent Variable

7. Select our Boolean Variable as the parent variable, and select whether a TRUE or FALSE condition is required to display this variable.

Select our Boolean Variable as the parent variable, and select whether a TRUE or FALSE condition is required to display this variable.

8. Click Save to update the variable

Click Save to update the variable

9. Export our Invent template as an MEX file

Export our Invent template as an MEX file

10. Import the MEX file into your MegaEdit product and Launch the product in the MegaEdit editor

Import the MEX file into your MegaEdit product and Launch the product in the MegaEdit editor

11. Select the Boolean Variable in the form

Select the Boolean Variable in the form

12. When set as TRUE, our second variable will be visible and selectable

When set as TRUE, our second variable will be visible and selectable
Alternate Search Terms