ODAG is different from Direct discovery, You can't use ODAG parameter values in Direct Query, Since direct query will run the script every time you select a values in dimension.
ODAG parameters are passed by ODAG extension to the Qlik Engine to create dynamic application. If you are using Direct query without ODAG parameters, it will work.
Actually when i am selecting single values this code is working even with direct discovery. but the problem is whenever i am selecting more than one value it is not taking that field restriction itself.
I know that ODAG and Direct discovery are different. My requirement is, I have to implement ODAG with
Thank you for the response.
I have used below mentioned code. It is working as expected.
SUB ExtendWhere(Name, ValVarName)
LET T = Name & '_COLNAME';
LET ColName = $(T);
LET Values = $(ValVarName);
IF len(Values) > 0 THEN
IF len(WHERE_PART) > 0 THEN
LET WHERE_PART = '$(WHERE_PART) AND ($(ColName) IN ( $(Values))) ';
LET WHERE_PART = 'WHERE ($(ColName) IN ( $(Values) ))';
SET Period = ;
SET Period = $(odso_Period);
SET Geography = ;
SET Geography = $(odso_Geography);
SET PROD = ;
SET PROD = $(odso_PROD);
SET WHERE_PART = '';
FOR EACH fldname IN 'Period', 'Geography','PROD'
LET vallist = $($(fldname));
WHEN (IsNull(vallist)) LET vallist = '';
IF len(vallist) > 0 THEN
TRACE Generated WHERE clause: ;