How do you pass a variable from a Qlik Sense Load Script during reload into an external program via an EXECUTE statement?Environments:
- Qlik Sense Enterprise, All Versions
1. Disable "Standard Mode" in order to enable the EXECUTE statement
in the load script. Warning: Disabling standard mode can create a security risk by exposing the file system.
2. Ensure the external script can accept command line arguments. For example, if using Python then import the argparse utility and use that to pass in arguments from the command line.
parser = argparse.ArgumentParser()
parser.add_argument('--foo', help='foo help example')
args = parser.parse_args()
print(args.foo) # just print back what was passed from the command line
input("Press any key to continue...") # keep the command line window open for demonstration purposes, note the script won't finish executing until the window is dismissed
3. Pass in your variables from the load script into the command line, similar to below (assumes python is in the PATH variable):
Set arg = "bar";
EXECUTE python C:\path\to\your\script\example.py --foo $(arg);
If you need further help/assistance, please reach out to Consulting Services. Ask for your Account Owner's contact information, or see How to Contact the Consulting Team?
Qlik does NOT
support the 3rd
party software mentioned and used in this documentation. Please use them at your own discretion and, if concerned, contact the proper IT team within your company to verify the ability to use non-Qlik related software in the environment.Note:
Debugging or writing custom code is supported by the Qlik Professional Services or Presales teams. This example is provided for demonstration purposes to explain specific scenarios. No Support or maintenance is implied or provided. Further customization is expected to be necessary and it is the responsibility of the end administrator to test and implement an appropriate rule for their specific use case.