Qenv()

Read(933) Label: qvs, global variable,

Description:

Set or get global variable for/from QVS.

Syntax:

Qenv(v,x)

Note:

The function sets global variable v, assigns value x to it for the controller QVS and returns true when the assignment succeeds. When parameter x is absent, the function gets the global variable from QVS.

In the QVS application, global variables are public and a script file can invoke any global variable.

Will be parsed as env() function when the controller QVS isn’t configured.Parameter:

v

Global variable name

x

Global variable value

Return value:

Global variable value/Boolean value

Example:

Ø  Set global variable for QVS

 Create setEnv.splx and upload the file to storage bucket qtc01 in cloud storage platform S3:

 

A

 

1

=Qenv("gvar1","Sale")

Set value of global variable gvar1 as Sale

 Execute script file setEnv.splx through QVS:

 

A

 

1

=Qconnect("http://54.213.221.123:8080/qvs":"aws-qvs",30,300)

Connect to QVS service

2

=A1.exec@x("qtc01/setEnv.splx";100)

Execute script file setEnv.splx on the cloud storage platform through QVS

 

Ø  Get global variable from QVS

Create getEnv.splx and upload the file to storage bucket qtc01 in cloud storage platform s3:

 

A

 

1

=Qenv("gvar1")

Get value of global variable gvar1

2

=Qfile("qtc01/Employees.txt")

Get Employees.txt stored in the cloud storage platform

3

=A2.import@t()

Retrieve content of A2’s file

4

=A3.select(Post:A1)

Use global variable to get records where Post value is Sale