3 Replies Latest reply: May 8, 2018 8:58 AM by P Kumar RSS

    ODAG- scripting model app

    Stefania Santalucia

      Hi,

       

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


      Thanks

        • Re: ODAG- scripting
          sai kishore

          Check with this. May be useful

            • Re: ODAG- scripting
              Stefania Santalucia

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

               

              its different!

                • Re: ODAG- scripting
                  P Kumar

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