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.
bcraymond
New Contributor III

Selecting variables when executing stored procedure in script

Im trying to select variables and alternate variables into parameters while executing a stored procedure in SQL via my qlikview script. What is the proper syntax for stating an alternate variable?

this is the original statment

Measure_Temp:

SQL EXEC mtzcus_ActiveMedList_60 '$(vFactoP)', '$(vFromDt)', '$(vToDt)','N';

I would like to replace 'vFromDt' with 'vFromDt2' when' vFactoP'='MOH'

I tried this, but it didnt work:

Measure_Temp:

SQL EXEC mtzcus_ActiveMedList_60 '$(vFactoP)', If((vFactoP='MOH')'$(vFromDt2)')'$(vFromDt)', '$(vToDt)','N';

Any help is appreciated..

thanks

Beth

Tags (1)
2 Replies

Re: Selecting variables when executing stored procedure in script

Perhaps something like this:

LET vFromDt = If('$(vFactoP)'='MOH', '$(vFromDt2)', '$(vFromDt)' ;

Measure_Temp:

SQL EXEC mtzcus_ActiveMedList_60 '$(vFactoP)','$(vFromDt)' ,'$(vToDt)','N';


talk is cheap, supply exceeds demand
bcraymond
New Contributor III

Re: Selecting variables when executing stored procedure in script

If I use $(vFactoP) in the statement:

LET vFromDt = If('$(vFactoP)'='MOH', '$(vFromDt2)', '$(vFromDt)'  

The script interprets as  (each variable in vFactoP = 'MOH')

If I use vFactoP without the dollar sign, it makes all vFactoP values use vFromDt2.

I cant seem to get the script to understand to apply vFromDt2 only when vFactoP = 'MOH'

Community Browser