Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I try to use bellow statement to decide if load a table into the document in script.
IF(SubStringCount(Concat(%DIM_LOADING_SERIES, '|'), 'XREF_Product_Master')>0) THEN
.........;
ENDIF
While I got error message shows,
"Script line error
IF(SubStringCount(Concat(%DIM_LOADING_SERIES, '|'), 'XREF_Product_Master')>0) THEN"
I do have the DIM_LOADING_SERIES loaded and selected in the front-end, then what could be the reason for error?
You can reference fields directly in aggregation functions only in load statements, not in if-then blocks. You can do it this way:
Temp:
LOAD substringcount(concat(%DIM_LOADING_SERIES, '|'),'XREF_Product_Master') as TestResult
RESIDENT DIM_LOADING_FILES;
IF (peek('TestResult')) THEN
// do stuff
ENDIF
You can reference fields directly in aggregation functions only in load statements, not in if-then blocks. You can do it this way:
Temp:
LOAD substringcount(concat(%DIM_LOADING_SERIES, '|'),'XREF_Product_Master') as TestResult
RESIDENT DIM_LOADING_FILES;
IF (peek('TestResult')) THEN
// do stuff
ENDIF
Thank you Gysbert, the solution works perfect!
Hi Gysbert,
I have to continue with this question a little bit more.
Please see attached image, here I create several list boxes which allow users to make selections, user pick the selection and assign a value to a variable.
For example, vDIMXref (I create this variable in user interface), when I select XREF_Product_Master in list box, then vDIMXref get 1.
Then I want to use this variable in script to decide if load table 'XREF_Product_Master' or not, here I can not succeed, I got a error message in attached image.
It looks like your variable vDIMXref contains an = sign in front of the expression. If that's correct you need to remove it.
when I remove the '=' sign, then the variable does not work, I define them in front end, then I need a '=' to calcuate value
I don't think I said to remove the = sign from all your variables. But you will have to remove it from the expression in vDIMXref
Hi Gysbert, from your solution to wava1978 (http://community.qlik.com/thread/65816), this is exactly the reason for my issue, perfect solution, thank you very much!