Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

balrajprabhu
Contributor

On Demand app ,edit the sub routine for QVD data source

In the ON Demand app ,the following sub routine :

// DO NOT ALTER THIS SUBROUTINE

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) )';

    ELSE

    LET WHERE_PART = ' WHERE $(ColName) IN ( $(Values) )';

    ENDIF

  ENDIF

END SUB;

The above code works when used against a sql data source.I want to edit the code so that it starts working for qvd layesr also.

This Involves making changes in the below code  using match ()   or Wildmatch ()  

LET WHERE_PART = '$(WHERE_PART) AND $(ColName) IN ( $(Values) )';

    ELSE

    LET WHERE_PART = ' WHERE $(ColName) IN ( $(Values) )';


Please advice





1 Reply
saurabhwadhwa
New Contributor III

Re: On Demand app ,edit the sub routine for QVD data source

Hi Balraj , Below is the script to load data from qvds . Just change the field names in the below script .

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 Match ($(ColName),$(Values) ) ';

     

    ELSE

    LET WHERE_PART = 'WHERE Match ($(ColName),$(Values) )';

    ENDIF

  ENDIF

END SUB;

SET BUSINESS_UNIT = ;

SET BUSINESS_UNIT = $(ods_BALANCE_SHEET.BUSINESS_UNIT);   //$(odso_Business_Unit);

SET BUSINESS_UNIT_COLNAME ='BALANCE_SHEET.BUSINESS_UNIT';

SET CNTRY_CDE = ;

SET CNTRY_CDE = $(ods_BALANCE_SHEET.CNTRY_CDE);

SET CNTRY_CDE_COLNAME='BALANCE_SHEET.CNTRY_CDE';

// // // SET DATE = ;

// // // SET DATE = $(odso_Date);

// // // SET DATE_COLNAME = 'BUSINESS_Date';

SET ACCOUNT = ;

SET ACCOUNT = $(ods_BALANCE_SHEET.FINMIS_RETAG_ACCT);

SET ACCOUNT_COLNAME ='BALANCE_SHEET.FINMIS_RETAG_ACCT';

//SET WHERE_PART = '';

FOR EACH fldname IN 'BUSINESS_UNIT','CNTRY_CDE','ACCOUNT'

  LET vallist = $($(fldname));

  WHEN (IsNull(vallist)) LET vallist = '';

  IF len(vallist) > 0 THEN

    CALL ExtendWhere('$(fldname)','vallist');

  ENDIF

NEXT fldname

TRACE Generated WHERE clause: ;

TRACE $(WHERE_PART);

Regards,

Saurabh

Community Browser