0 Replies Latest reply: Oct 28, 2016 7:28 AM by Court van de Lisdonk RSS

    If Else Statement

    Court van de Lisdonk

      Hello,

       

      I'm build an Access Control in a Qlikview Document like:



      Star is *;

      // SECTION Access;

      // SUPER ADMIN
      LOAD * INLINE [
          ACCESS, USERNAME, PASSWORD, MARKER_COMPANIES, MARKER_DATALEVEL,MARKER_SELLTOCUSTOMER, MARKER_EXCLUDINGINVOICENUMBER, MARKER_EXCLUDINGITEMS, MARKER_COMPANY, MARKER_DIVISION, MARKER_SALESDISTRICT, MARKER_CUSTOMER
          ADMIN, QADMIN, QADMIN, ALL, ALL, ALL, ALL, ALL, ALL, ALL, ALL, ALL
          ];

      LOAD
            if (ALLDIMENSIONVALUESALLOWED = '-1', 'ADMIN', 'USER') as ACCESS,
            USERNAME,
            PASSWORD,

       

      if  (REPORTINGALLOWANCEDEMENSION_PK = '1') then (DIMENSIONVALUEALLOWED as MARKER_COMPANY);
      elseif  (REPORTINGALLOWANCEDEMENSION_PK = '3' ) then DIMENSIONVALUEALLOWED as MARKER_DIVISION;
         elseif  (REPORTINGALLOWANCEDEMENSION_PK = '5' ) then DIMENSIONVALUEALLOWED as MARKER_SALESDISTRICT;
           else DIMENSIONVALUEALLOWED as MARKER_CUSTOMER;
      ENDIF

       

      //      PK,
      //      REPORTINGUSERPK,
      //      REPORTINGALLOWANCEDEMENSION_PK,
      //      DIMENSIONVALUEALLOWED,
      //      DIMENSIONVALUEVAILEDFROM,
      //      DIMENSIONVALUEVAILEDTO,
      //     DIMENSIONNAME,
      //     ISACTIVE,
      //     DEFTABLESCHEMA,
      //     DEFTABLENAME,
      //     DEFVALUECOLNAME
      From [C:\Qlikview\Datasources\qvd\PrimDef_ReportingUserDimValueAllowed.qvd] (qvd);

       

      exit script;

       

      The Problem I have is the if .... else Statement: it does not work

      the Messages I get are :

       

      Syntax Fehler: FROM fehlt/falsch:

      LOAD

            if (ALLDIMENSIONVALUESALLOWED = '-1', 'ADMIN', 'USER') as ACCESS,

            USERNAME,

            PASSWORD

       

      if  (REPORTINGALLOWANCEDEMENSION_PK = '1') then (DIMENSIONVALUEALLOWED as MARKER_COMPANY)

      LOAD

            if (ALLDIMENSIONVALUESALLOWED = '-1', 'ADMIN', 'USER') as ACCESS,

            USERNAME,

            PASSWORD

       

      if  (REPORTINGALLOWANCEDEMENSION_PK = '1') then (DIMENSIONVALUEALLOWED as MARKER_COMPANY)

       

      and

      Fehler in Skriptzeile:

      elseif  (REPORTINGALLOWANCEDEMENSION_PK = '3' ) then DIMENSIONVALUEALLOWED as MARKER_DIVISION

      etc.

       

      I hope that someone can help me and has a solution for my problem

       

      Thanks in advance