5 Replies Latest reply: Jun 21, 2016 8:28 AM by Sangram Reddy RSS

    Limitations in Qlik Sense script?!

    Ali Hijazi

      Hello

      I got a script in a QVF file

      I put the script in Subs and at the end I call the sub in order as follows:

      CALL CONNECT_TO_DATABASE

      CALL READ_TRANSACTIONS

      CALL READ_PRODUCT

      CALL READ_PRODUCT_CATEGORY

      CALL CREATE_MASTER_CALENDAR

      call ROLLING_CALENDAR

      CALL SAVE_SUPPLIER

      CALL READ_CUSTOMER

      CALL READ_SALESMAN

      CALL READ_WAREHOUSE

      CALL READ_SECTIONS

      CALL ITEM_DAILY_BALANCE;

      CALL SUPPLIER_DAILY_BALANCE;

      call CUSTOMER_DAILY_BALANCE;

      CALL SUPPLIER_STATEMENT_OF_ACCOUNT

      CALL CUSTOMER_STATEMENT_OF_ACCOUNT

       

      whenever the last sub is called I get an error object could not be saved (in this sub at the end I save the table as QVD)

      and then I cannot save the qvf I get the error message object could not be saved

      The QVD is being created but it seems that the application could not be saved because if I run the script in debug mode i get success execution but when I click the save button I get the below error

      error_1.png

      However if I comment out all calls and keep the last two they work successfully

       

      any idea why?

       

      Message was edited by: Ali Hijazi

        • Re: Limitations in Qlik Sense script?!
          Clever Anjos

          Would you mind sharing this sub?

          CUSTOMER_STATEMENT_OF_ACCOUNT

            • Re: Limitations in Qlik Sense script?!
              Ali Hijazi

              SUB CUSTOMER_STATEMENT_OF_ACCOUNT

               

               

               

                TEMP_ACCOUNTING:

                  LOAD

                      CompanyCode,

                      'Customer Account State' as TrxType,

                      num(daystart(TrxDate)) as TrxDate,

                      LineDesc,

                      JVTypeCode,

                      JVType,

                      JVCat,

                      JVLineID,

                      JVDocRef,

                      JVNo,

                      JVDC,

                      ValueCY,

                      ValueLBP,

                      ValueUSD,

              //         CustomerKey as CUSTOMER_ID

                      ApplyMap('MAP_CUSTOMER',CustomerKey,NULL()) AS CUSTOMER_ID

                  FROM [lib://QVD_FILES_LOCATION/TRX_DETAIL.QVD]

                  (qvd)

                  WHERE TrxType='Accounting'

                          AND JVCat = 'JV Details Customer'

                          and Source = 'Dolphin'

                          ;

                 

                

                  TEMP_ACCOUNTING_1:

                  NoConcatenate

                  LOAD *

                  RESIDENT TEMP_ACCOUNTING

                  ORDER BY JVCat, CompanyCode, CUSTOMER_ID, TrxDate, JVNo, JVLineID;

                  DROP TABLE TEMP_ACCOUNTING;

                 

                  TEMP_ACCOUNTING_2:

                  LOAD *

                      , IF(ROWNO() = 1 OR JVCat <> previous(JVCat) or CUSTOMER_ID <> previous(CUSTOMER_ID) or CompanyCode <> previous(CompanyCode)

                          , ValueCY,ValueCY + peek(BalanceValueCY)) as BalanceValueCY

                      , IF(ROWNO() = 1 OR JVCat <> previous(JVCat) or CUSTOMER_ID <> previous(CUSTOMER_ID) or CompanyCode <> previous(CompanyCode)

                          , ValueLBP,ValueLBP + peek(BalanceValueLBP)) as BalanceValueLBP

                      , IF(ROWNO() = 1 OR JVCat <> previous(JVCat) or CUSTOMER_ID <> previous(CUSTOMER_ID) or CompanyCode <> previous(CompanyCode)

                          , ValueUSD,ValueUSD + peek(BalanceValueUSD)) as BalanceValueUSD

                  RESIDENT TEMP_ACCOUNTING_1;

                  DROP TABLE TEMP_ACCOUNTING_1;

                 

                  STORE TEMP_ACCOUNTING_2 INTO [lib://QVD_FILES_LOCATION/CUSTOMER_STATE_ACCOUNT.QVD];

                  DROP TABLE TEMP_ACCOUNTING_2;        

                        

               

                     

              ENDSUB

            • Re: Limitations in Qlik Sense script?!
              Ali Hijazi

              Actually I copied the script to another qvf file and it worked successfully!!