Ignite-UX Custom Configuration files
}
Since we can test on the initial value of _my_location_codes, we can show an error and prevent
any installation from continuing if a location code has not been set. If one has been chosen we can
print out information about the location code.
Part B (looking at the same thing when we don’t have an enum)
The following configuration is what we want to end up with in this case. We will look at what it
contains line by line and then look at how the variable can be used:
init _my_location_codes = "Not Valid"
_my_location_codes = { "AAA000", "AAA001", "AAA002", "AAA003" }
_my_location_codes visible_if TRUE
_my_location_codes help_text "Choose a location code”
We can tell that we’re looking at something different from the previous part of this example since
the enum keyword isn’t being used. Since we haven’t used enum, the variable is not restricted to
the list of predefined values.
That means the person performing the installation can choose a value from a list (similar to enum)
or they can enter a value directly into the field using the additional button on the basic tab in
itool.
This approach offers more flexibility than an enum. One example use would be the name of a user
in a configuration variable - there might be some commonly set values, but you don’t want to
restrict input to just that list. In such a case you might provide the common user names to choose
from but allow the person performing the install to enter any user name.
The same configuration used above can still be used to validate the variable. We can ensure that
the value has been set to something other than the initial value of “Not Valid”:
( _my_location_codes == "Not Valid" ) {
error+="You have not selected a location code."
} else {
note+="The location code selected was " + ${_my_location_codes}
}
Again, note the use of the keyword init before _my_location_codes. The init keyword is
required when the configuration assigns a value to a variable the user will to be able to change. If
it is not present, the user interface (the additional button on the basic tab in itool) will not
accept changes to the value of the variable (you can change it but the changes will not take effect.)
An example of a variable defined in this way is the configuration variable
_hp_addnl_fs_free_pct (covered elsewhere in this document.)
Example Six (handling command line arguments)
This example examines building variables that are based upon other variables. For this example
we are going to construct a set handlers for command line arguments. We have three arguments to
cater for, those arguments are:
-a which is fixed and doesn't change
-b which only takes a value between 1 and 10
142