Qlik Community

Ask a Question

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
QlikWorld Online 2021, May 10-12: Our Free, Virtual, Global Event REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
nilton_tarea
Partner
Partner

Qlik CLI set variable problem (SaaS)

I'm passing problem's to set a variable using Qlik-CLI.

I know a part of syntax to pass a variable, using the command in Power Shell:

qlik app variable set --help

this returns for me:

Set or update the variables in the current app

Usage:
qlik app variable set <glob-pattern-path-to-variables-files.json> [flags]

Examples:
qlik app variable set ./my-variables-glob-path.json

Flags:
-h, --help help for set
--no-save Do not save the app

Global Flags:
-a, --app string Name or identifier of the app
-c, --config string path/to/config.yml where parameters can be set instead of on the command line
--context string Name of the context used when connecting to Qlik Associative Engine
--headers stringToString Http headers to use when connecting to Qlik Associative Engine (default [])
--insecure Enabling insecure will make it possible to connect using self signed certificates
--json Returns output in JSON format if possible, disables verbose and traffic output
-s, --server string URL to a Qlik Product, a local engine, cluster or sense-enterprise
-v, --verbose Log extra information

 

When i try again using the parameters like:

qlik app variable set { v: "1" } --app "xxxxxxxxxxxxxxxxxx"

I get an error:

Error: unknown shorthand flag: 'e' in -encodedCommand

Where is the systax error?

1 Reply
bgk
Employee
Employee

Hello,

The qlik-cli command
qlik app variable set

consumes a json file containing a GenericVariable object.

With your example, create a json file (var.json) containing:

{
  "qInfo": {
    "qId": "myId",
    "qType": "variable"
  },
  "qName": "v",
  "qDefinition": "1"
}

and use

qlik app variable set var.json -app "xxxx"

If you already have variables in the app, you can list them and view the content to get to know the format more.

qlik app variable ls --app "xxxx"

qlik app variable properties variable-name --app "xxxx"

Hope it helps.