Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
s_santalucia
Partner - Creator
Partner - Creator

ODAG- scripting model app

Hi,

Is there anyone available to explain how to write the model app script?


Thanks

3 Replies
kakani87
Specialist
Specialist

Check with this. May be useful

s_santalucia
Partner - Creator
Partner - Creator
Author

hi, thank you for your answer, but I want scriptn for ODAG!

its different!

pawwy1415
Creator III
Creator III

Hi,

For ODAG need to create two apps

1. one for summary app which is you Final UI app where you will apply selections.

2. Detail app - here need to write the ODAG Script.

if you are working with sql database need to follow the below code just update with your fields everything remains same

// 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;

SET ACCOUNTID= ;

SET ACCOUNTID= $(ods_ACCOUNT);  //this ACCOUNT field name should match with your summary app field

SET ACCOUNTID_COLNAME='a.accountid'; //this a.accountid field name should match with your database field

SET COMPANYID= ;

SET COMPANYID= $(ods_COMPANY);

SET COMPANYID_COLNAME='a.companyid';

SET WHERE_PART = '';

//First Set Statement Variable fields ACCOUNTID, COMPANYID need to pass at For Loop

FOR EACH fldname IN 'ACCOUNTID', 'COMPANYID'

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

LOAD

     1 AS "FLIGHT_COUNT",

     ACCOUNTID as "ACCOUNT",

      COMPANYID as "COMPANY";

 

SQL SELECT

          a.accountid,

          a.companyid

FROM "SAPH7T"."/QT/AIRPORT_FACT"

$(WHERE_PART);