Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
Anonymous
Not applicable
Author

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!!!!

View solution in original post

2 Replies
swuehl
MVP
MVP

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.

Anonymous
Not applicable
Author

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!!!!