8 Replies Latest reply: Feb 3, 2014 2:50 AM by philipp kunz RSS

    loop and reduce qvw file that has already been looped and reduced

    philipp kunz

      HI, i hope someone can help me. I have a document.qvw that i would like to loop and reduce

      over a field (region) that generates 4 new documents ( region-north,region-east,region-south and region west).

      is it possible to then distribute these  4 generated qvw files to a specific folder and then add  an additional  "loop field in document task to these 4 new qvw's ? is this possible?  unfortunately i need to perform these two steps, since my database does not allow me to loop and reduce and loop field in document within one task. thanks in advance.

        • Re: loop and reduce qvw file that has already been looped and reduced
          Carlos Reyes

          Why don't you create a field that has all the final combinations and use that?

           

          For instance... if the first loop and reduce is by Region, the next by State, the next by City, then Create a Field that combines the three:

           

          Region & '_' & State & '_' & City as LoopAndReduceField

           

          Then... use that field to run the task.

          • Re: loop and reduce qvw file that has already been looped and reduced
            philipp kunz

            hi again,

             

            or is it possible to apply Section Access to these 4 qvw files after the big document.qvw as been looped and reduced up to the 4 smaller qvw files. if yes, how could this be done? thanks!

              • Re: Re: loop and reduce qvw file that has already been looped and reduced
                Carlos Reyes

                You can do that too..

                 

                If you load the Section Access table in the first QVW (before the loop and reduce task that creates the 4 files), then you don't need to add or do anytrhing to the 4 files that will be created at the end of the task. The only requirements  are that the Section Access table has all the possible profiles from the start and that you provide the appropiate USER - APPLICATION access.

                 

                For instance... I'm guessing that your Section Access table should look like the next:

                 

                 

                ACCESS, NTNAME, REGION, STATE, CITY

                 

                USER, DOMAIN\USER1, NORTH, NUEVOLEON, MONTERREY

                USER, DOMAIN\USER1, NORTH, SONORA, HERMOSILLO

                USER, DOMAIN\USER2, CENTER, HIDALGO, PACHUCA

                USER, DOMAIN\USER2, CENTER, QUERETARO, QUERETARO

                USER, DOMAIN\USER3, SOUTH, CHIAPAS, TUXTLA

                USER, DOMAIN\USER4, SOUTH, CHIAPAS, TAPACHULA

                USER, DOMAIN\USER5, SOUTH, TABASCO, VILLAHERMOSA

                 

                 

                 

                So...

                 

                USER1 must be given access to the NORTH application and will be able to see all STATES and CITIES from that REGION.

                USER2 must be given access to the CENTER application and will be able to see all STATES and CITIES from that REGION.

                USER3 must be given access to the SOUTH application and will be able to see the STATE of CHIAPAS and the CITY of TUXTLA.

                USER4 must be given access to the SOUTH application and will be able to see the STATE of CHIAPAS and the CITY of TAPACHULA.

                USER5 must be given access to the SOUTH application and will be able to see the STATE of TABASCO and the CITY of VILLAHERMOSA.

                 

                Hope this helps!

              • Re: loop and reduce qvw file that has already been looped and reduced
                philipp kunz

                hi carlos, many thanks for help.

                 

                i already applied the section access in the first qvw,but that did not lead to my desired result.

                but if u say i can loop and reduce a qvw file that is result of a former loop and reduce a second time, thn that sounds great. but can i apply a script to these 4 qvw files too? probably not....

                  • Re: loop and reduce qvw file that has already been looped and reduced
                    Carlos Reyes

                    Hi Philipp,

                     

                    What's the problem with Section Access? What's your desired result and what did you get?

                     

                    I guess it's possible to loop and reduce a qvw file that is result of a former loop and reduce a second time, but you'll need to add the first loop and reduce store directory as a source directory... so that you can use those files as source for the new tasks... Although... In my opinion...doing that will add a lot of complexity to the tasks.

                     

                    What do you mean by applying a script to 4 files? Have you heard of include statements? You can use a script block in several qvw if you import it with the Include statement. See the qlikview help to learn about it.

                     

                    I honestly think that my first suggestion (Create and use a composed field for the loop) is your best option. Why don't you try it?

                      • Re: loop and reduce qvw file that has already been looped and reduced
                        philipp kunz

                        hi carlos, i know making a keyfield out of several field is alwas a good choice, but one of these fiels has 150 variations which means 150 results after the loop and reduce. thats too much for the server to distribute. so i wanted the big qvw to be divided into 6 categories by another field and then apply section access to these 6 qvw documents. i cannot apply section access to the big qvw before the loop and reduce because if i do then the hide/show sheet condition (which is part and implemented in section access aswell) doesn't work anymore when opening the document on access point. as you  can read there are several things that are coming together in this special case. have u ever looped and reduced a document with section access implemented and hide/show sheet condition in publisher that as a result worked out fine? greets.

                          • Re: loop and reduce qvw file that has already been looped and reduced
                            Carlos Reyes

                            Ok,

                             

                            Now I get the whole idea. In that case I think your best choice is to create 6 files, one for each category. In each qvw you'll have to load the data from qvd's or binary load while restricting the values so that you only load the records associated to each category. Also in each file you should load the section access table, and create one task for each file and distribute them to the appropiate users.

                             

                            I just tested my previous suggestion but it's a waste of time... Yeah.. you can distribute and create the 5 files, but then you have to manually change Document properties to enable reload, define script code and create different distribution tasks... so it's not worth it, it just adds work and increases the error possibilites... I'm sorry for offering that suggestion, As far as I know... the process described in the above paragraph it's the most efficient choice.

                      • Re: loop and reduce qvw file that has already been looped and reduced
                        philipp kunz

                        Hi Carlos,

                        thanx once again for your help. I finally had my problem solved (through one of your posts regarding Section access plus hide/sheet conditions). That helped a lot! Thanx and greetings!