23 Replies Latest reply: Mar 15, 2011 8:41 AM by Ivan Drago RSS

    Section Access - Help

    Ivan Drago

      Hi,

      I want to use the Section Access but do not know where to start, I have the attached
      document, on here there is a field called AreaId, I want this to be limited based on what the
      user has access to, for example

      UserID AreaID
      BobA 1235
      BobA 1237
      DavR 1236
      DavR 1235
      SimS See All

      So UserID SimS can see all ther data on the document, how would I be able to do this?

      Thanks

        • Section Access - Help
          Deepak Kurup

          hi ,

          Below is the code for Section Access.

          Section Access;

          LOAD * INLINE [

          ACCESS, USERID, PASSWORD ,AREAID

          ADMIN ,abc,abc,111

          ];

          Section Application;

          the AREAID need to be link with you data AREAID.

          In section ACCESS the fieldname should be in CAPITAL letters.

           

          I hope this helps.

           

            • Section Access - Help
              Ivan Drago

              Hi Deepak,

              I have added the following to the script?

              Section Access;

              LOAD * INLINE [

              ACCESS, USERID, AREAID

              ADMIN ,BobA, 1235

              ];

              Section Application;

              Load * INLINE [
              AreaId
              1235
              ];

              Is this right? Also do I have to amend anything on the Document Properties?

                • Section Access - Help
                  Deepak Kurup

                  OPs I forgot,

                  yes you need to go to Document Properties-- Opening tab--Select intial Data reduction and untrict strict exclusion

                   

                  and in your script the Areid in the scond table needs to be in Capital same as in Section Access

                    • Section Access - Help
                      Ivan Drago

                      Hi Miguel,

                      What do I need to put in the SECTION APPLCATION? I have made AREAID as upper case now. Also I don't want it to ask the user for a password when they click on the Document from Access Point, as they will only see the document if I have authorized them as a user, I just want it so when it opens the Document it is limited based on the AREAID they have access to.

                      Thanks

                        • Section Access - Help
                          Ivan Drago

                          Hi

                          I have created a qvd first which will hold all the users, below is script:

                          ACtrl:
                          SQL SELECT
                          'USER' as ACCESS,
                          UPPER(LTRIM(RTRIM(NETWORKID))) as USERID,
                          AreaId as AREAID
                          From TableA;

                          CONCATENATE
                          LOAD * INLINE [
                          ACCESS, USERID, AREAID
                          USER, SIMS, 1237];

                          STORE ACtrl INTO C:\ACtrl.qvd (QVD);

                          I have then gone into my Document and added the following:

                          STAR IS *;

                          SECTION ACCESS;
                          Security:
                          LOAD [ACCESS],
                          USERID,
                          AREAID
                          FROM
                          [C:\ACtrl.qvd]
                          (qvd);


                          SECTION APPLICATION;
                          LOAD
                          AREAID
                          FROM [C:\ACtrl.qvd]
                          (qvd);

                          I have rloaded the Document but it comes up with "Execution of Script failed. Reload old Data?", I have not ticked the following yet "go to Settings menu, Document Properties, Opening, and checking "Initial Reduction..." and "Strict exclusion" as I do not want to be locked out as of yet?

                           

                           

                          • Section Access - Help
                            Miguel Angel Baeyens de Arce

                            Hello,

                            You do need to set the SECTION APPLICATION because it's the way you tell QlikView you are going to start loading data that doesn't belong to the section access.

                            If you don't want to ask for password, use NTNAME in section access instead of USERID and PASSWORD, and set it to the result of the function OSUser() in the client's computer, so the data will be reduced, although the user won't be prompted for password. Your section access table will look like then

                             

                            LOAD * INLINE [ACCESS, NTNAME, AREAIDADMIN, DOMAIN\ADMINACCOUNT, *USER, DOMAIN\USER1, 253USER, DOMAIN\USER1, 254];


                            To your other post above, when you load section access from QVD files, you need to perform the load unoptimized, so you need to add something (the following works) to your LOAD statement

                             

                            LOAD USERID, PASSWORD, ACCESSFROM File.qvd (qvd) WHERE 1=1; // This line prevents the optimized load


                            Hope that helps.

                              • Section Access - Help
                                Ivan Drago

                                Thanks Miguel, so can you see why the below script would fail then?


                                SECTION ACCESS;
                                Security:
                                LOAD [ACCESS],
                                NTNAME,
                                AREADID
                                FROM
                                [C:\ACtrl.qvd]
                                (qvd);


                                SECTION APPLICATION;

                                STAR IS *;

                                Reduction:
                                LOAD NTNAME,
                                AREAID
                                FROM [C:\ACtrl.qvd]
                                (qvd);

                                  • Section Access - Help
                                    Miguel Angel Baeyens de Arce

                                    At a first glance, you haven't applied the changes I mentioned above:

                                     


                                    IvanDrago wrote:STAR IS *;
                                    SECTION ACCESS;
                                    Security:
                                    LOAD [ACCESS],
                                    NTNAME,
                                    AREAID
                                    FROM [C:\ACtrl.qvd] (qvd) WHERE 1=1;

                                    SECTION APPLICATION;

                                    //Reduction: // There's no need for this one, commented
                                    //LOAD NTNAME,
                                    // AREAID
                                    //FROM [C:\ACtrl.qvd] (qvd);


                                    Hope that helps.

                                      • Section Access - Help
                                        Ivan Drago

                                        Hi Miguel, That seems to work now! Thanks!

                                        I have added users that are not in TableA to the following ACtrl.qvd by doing a CONCATENATE under the first SELECT, how do I make these users be able to View all of the data within the Document?

                                          • Section Access - Help
                                            Miguel Angel Baeyens de Arce

                                            Hi,

                                            In order to get one user able to see all the records, you need first all possible values for your reduction field (AREAID) listed in the section access:

                                             

                                            CONCATENATE LOAD * INLINE [ ACCESS, NTNAME, AREAID USER, DOMAIN\USER1, AAA USER, DOMAIN\USER2, BBB USER, DOMAIN\USER2, CCC USER, DOMAIN\USER3, * ];


                                            In this case, User3 will be able to see all listed values (AAA, BBB, CCC). However, if the field AREAID has more values not listed in the section access, these will be reduced from the document, so the user will not see them. Say you add a new record with ZZZ as AREAID, and that you want USER3 to read it. You will have to add a new record to the table above (before the "*" line)

                                             

                                            USER, DOMAIN\USER3, ZZZ


                                            So again, any possible value that you want to be visible must be listed in the reduction field.

                                            Hope that helps.

                                              • Section Access - Help
                                                Ivan Drago

                                                Thanks Miguel! It now works! For some reason though, the document does not run on the server, runs when I run it manually on the server, but if I kick it off via the Tasks it runs for a second then stops? Do I have to change something on the Reload page?

                                                  • Section Access - Help
                                                    Miguel Angel Baeyens de Arce

                                                    Hello Ivan,

                                                    I'm glad to help.

                                                    And yes, you have to set an administrator account in the Reload tab in the QlikView Management Console. If you take a look at the bottom of the page, there you have a field for both user and password. These must be set as ADMIN in your section access, so the document reloads with all possible data.

                                                    Hope that helps.

                                • Section Access - Help
                                  Miguel Angel Baeyens de Arce

                                  Hello,

                                  The piece of script related to section access should look like

                                   

                                  STAR IS *; SECTION ACCESS; // All fieldnames must be UPPPERCASELOAD * INLINE [ACCESS, USERID, PASSWORD, AREAIDUSER, BOBA, BOBA, 1235USER, BOBA, BOBA, 1237USER, DAVR, BOBA, 1236USER, DAVR, DAVR, 1235USER, SIMS, SIMS, *ADMIN, ADMIN, ADMIN, *]; SECTION APPLICATION; // Your script here


                                  Provided you already have an "AREAID" (uppercase, if not, just rename your field AreaID to AREAID) in your data model, go to Settings menu, Document Properties, Opening, and checking "Initial Reduction..." and "Strict exclusion" (so any user not logged in or without data associated to its user won't be able to log in).

                                  Users will be prompted for user and password, and those must match the ones set in the section access (all user and password in uppercase)

                                  Hope that helps.