Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
moningi13579
New Contributor III

Passing the Field Selection into the Script

HI Guys,

I have an Stored procedure in My SQL Server which I want to execute in Qlikview , I need to pass the value to the stored procedure by selecting on the field in Qlikview  upon which I need to reload the data to get the values returned by the proc

I have used

SQL EXEC Proc_Name '$(vSL)','$(vEL)';

vStartLocation= getFieldSelection(Source Name)

vEndLocationL = GetFieldSelection(Destination Name)

LET vSL= $(vStartLocation);

LET vEL = $(vEndLocation);

the values vStartLocation and vEndLocation are declared in the variable overview and vEL and vSL are declared in the script, but the problem it is not passing the values into the variables

Can someone help me on this?

Thank you,

Vivek

1 Solution

Accepted Solutions
manucamon
Valued Contributor III

Re: Passing the Field Selection into the Script

Hi vivek,

You cannot use GetFieldSelections on Script, but you can use Vars on Script.

On Script:

IF Len('$(vSL)')>1 and Len('$(vEL)')>1 THEN

     SQL EXEC Proc_Name '$(vSL)','$(vEL)';

END IF;

On design:

Create one action on Field Triggers, on each field, on document properties.

Source Name field -> Set Variable:

     vSL -> =If(GetSelectedCount([Source Name])=1,[Source Name],' ')

Destination Name field -> Set Variable:

     vEL -> =If(GetSelectedCount([Destination Name])=1,[Destination Name],' ')

Create a button with Show Condition:

     IF(GetSelectedCount([Source Name])=1 and GetSelectedCount([Destination Name])=1,True(),False())

     This button may have one action, External -> Reload

Regards!!!!

2 Replies
MVP
MVP

Re: Passing the Field Selection into the Script

GetFieldSelection() can't be executed in the script context.

Try creating a trigger OnSelect for fields Source and Destination Name in the front end (settings - document properties - triggers) and use an External - Set Variable action to copy the selection value to a variable.

manucamon
Valued Contributor III

Re: Passing the Field Selection into the Script

Hi vivek,

You cannot use GetFieldSelections on Script, but you can use Vars on Script.

On Script:

IF Len('$(vSL)')>1 and Len('$(vEL)')>1 THEN

     SQL EXEC Proc_Name '$(vSL)','$(vEL)';

END IF;

On design:

Create one action on Field Triggers, on each field, on document properties.

Source Name field -> Set Variable:

     vSL -> =If(GetSelectedCount([Source Name])=1,[Source Name],' ')

Destination Name field -> Set Variable:

     vEL -> =If(GetSelectedCount([Destination Name])=1,[Destination Name],' ')

Create a button with Show Condition:

     IF(GetSelectedCount([Source Name])=1 and GetSelectedCount([Destination Name])=1,True(),False())

     This button may have one action, External -> Reload

Regards!!!!

Community Browser