exec()

Read(1571) Label: exec,

Here’s how to use the exec() function.

qvm.exec()

Description:

Execute a SPL script file through QVS.

Syntax:

qvm.exec(splx,…;t)

Note:

The function executes a SPL script file through QVS.

 

When configuring cloud storage connection through QVS, execute the target script file on the cloud storage platform; if the cloud storage is not configured, execute the script in the QVM main directory.

Parameter:

qvm

A QVM object

splx

A SPL script file

Parameter(s) of the splx file; multiple parameters are separated by comma

t

Time-out (unit: second); default is 120

Option:

@x

Automatically close QVM when final value is returned

Return value:

Return value of the SPL script file

Example:

Ø  Execute script file on the cloud storage platform

Create script file sEmp.splx, for which cellset parameters arg1 and arg2 are added:

 

A

 

1

=Qfile("qtc01/Employees.txt")

Read Employees.txt in storage bucket qtc01.

2

=A1.import@t()

Return file content as a table sequence.

3

=A2.select(Gender:arg1,Post:arg2)

Select records meeting the specified condition.

4

return A3

Return A3’s result.

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

 

A

 

1

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

Request QVA through QVS to access QVM.

2

=A1.load("qtc01/sEmp.splx")

Upload script file sEmp.splx to storage bucket qtc01 on the cloud storage platform.

3

=A1.exec@x("qtc01/sEmp.splx","Male","Sale";100)

Execute script file sEmp.splx in storage bucket qtc01, and pass Male to parameter arg1 and Sale to parameter arg2, and set time-out as 100s.

As @x option is present, automatically close QVM when execution result is returned.

Ø  Execute script file in QVM main directory

Create script file getfileqvm.splx, add cellcet parameter txtfile to it, save the file and upload it to QVM main directory:

 

A

 

1

=file(txtfile)

Pass txt format data file name through parameter txtfile.

2

=A1.import@t()

Import data file content.

Execute script file getfileqvm.splx in QVM main directory:

 

A

 

1

=Qconnect("http://localhost:8090/qvs":"demoqvs",30,300)

Request QVA through QVS to access QVM.

2

=A1.load("tran.txt")

Upload data file tran.txt to QVM main directory.

3

=A1.load("getfileqvm.splx")

Upload script file getfileqvm.splx to QVM main directory.

4

=A1.exec("getfileqvm.splx","tran.txt";100)

Execute script file getfileqvm.splx in QVM main directory, and pass "tran.txt" to parameter txtfile, and set time-out as 100s.

5

>A1.close()

Close QVM.