Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
bcraymond
Partner - Contributor III
Partner - 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

2 Replies
Gysbert_Wassenaar

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
Partner - Contributor III
Partner - Contributor III
Author

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'