In this article, we'll be covering how to use parameters when executing a script via a Control Point within Infogix Assure. To learn how to execute a script within Infogix Assure, please see this article: Using Infogix Assure to Execute a Script from a Control Point
Batch/Shell Scripts
Suppose you have a script that displays 4 variables:
echo "The parameters are: " %1 %2 %3 %4
If you called the script with the parameters "10 5 ten five", you would get the following output:
The parameters are: 10 5 ten five
With that in mind, let's look at at adding a parameters in Assure. When you select the "Add Parameter" button, you'll see the following window in the bottom pane.
What we're concerned about is the "Argument" field. This field is not necessary, and can be left blank if you so choose. It's primary use is for running scripts from the server-util folder for Assure. More information about this can be found further below. However, for this article we'll be entering in a value.
If you check the "Parameter value is a file" box, it is telling Assure that the value you enter later on will be a filename.
Once you enter in values and hit the Apply button, you'll see the Parameter appear in the top screen. Upon clicking on it, you'll see the "Add Function", "Add Operation", and "Add Literal" buttons light up.
You can add values with fields (through the Validation tab only), functions, operators, and literals. Once you hit "Apply", it will look like this. I added a literal text value called "Value1".
Now, back to our 4 variable example. If you ran the script with just that parameter, the result would be:
The parameters are: Arg1 Value1
When Assure calls scripts, it puts the Argument and Value into the script as parameters. If you added a second parameter and entered in a value for Argument and Value there, you'd have all 4 variables show. You can see Assure putting these values in when you call it in the IGX logs. Here's a snippet:
In this case, the output of our script would be:
The parameters are: arg1 31 arg2 491
If you leave the Argument field blank, it will not appear at all, resulting in only two parameters being posted to the script.
Server-Util Scripts
Scripts from the "server-util" folder are built differently than a script you might make on your own. For example, let's take a look at the runcp script. With that script, you can call argument names such as -point or -runno to specify to the script which control point to run and various other variables. Here's a list:
Parameter |
Description |
-S ‘datasourcename=url’ |
Overrides the URL or path specified in the layout or control point definitions for one or more data sources. To specify more than one override, enter a space between each override pair. Enclose the source name or path in quotation marks if it contains spaces. |
-c ‘configname’ |
If you invoke the run control point program from a remote platform, specify which client configuration to use to connect to the appropriate Infogix Assure server instance. If you deployed only one client configuration (named "default"), this parameter is optional. |
-cycle ‘YYYYMMDD’ |
Overrides the cycle number defined for this control entity or application. |
-local |
The Infogix Assure client does not support local data capture for data quality control points. Specify the -local parameter to capture input data from a source local to the Infogix Assure client, such as an input file located on the machine where the client runs. Do not use this parameter to capture data from an input source on the server or when running runcp_standalone. Local mode supports JDBC database connections, but not JNDI connections. |
-rerun |
Specifies that the run is a rerun, meaning that the run has the same cycle and run number as a prior run. |
-runno ‘nnn’ |
Overrides the run number defined for this control entity or application. |
Now, runcp needs two arguments to run successfully: -entity and -point, which are the Control Entity and Control Point, respectively. The others listed above are optional.
This is where arguments come into play. Using the Argument field allows you to specify these parameters and provide values for them. Here's an example:
And then the value:
You would do this for every parameter you want to include. Make sure you include the "-" character in the argument, or else it won't work!
Comments
0 comments
Please sign in to leave a comment.