18 Replies Latest reply: Apr 14, 2015 8:36 AM by Friedrich Hofmann RSS

    STORE after reload

    Jose Maria Sanchez Herrero

      Hello,

      I would like to know if there is some way I can make a STORE after the script has been run succesfully.

       

      I mean, imagine that I have a process which takes a lot of time to be reloaded and I'm doing some data processing in the script so I can't check it until it's finished. Once it has finished and I have checked the processing is correct, I would like to make an STORE from the "Fact" table without reloading the whole script with a STORE at the end.

       

      Is it possible? Any ideas?

       

      Thanks!

        • Re: STORE after reload
          Friedrich Hofmann

          Hi jsanchezh,

           

          that should be possible by way of a PARTIAL RELOAD where only some parts of the script are executed during the reload and the ´memory is not completely emptied at the start of the script - but I have heard that function is still kind of whacky and doesn't always work.

          A possibility would be if you run that app locally (not possible on server) and you can somehow implement your checks in the script itself, you could include some TRACE statements and generate an input box to ask you if you want to STORE the results or not.

          Apart from that, I don't know any possibility.

          HTH

           

          P.S.: The input box (it's a function) generates a variable out of your input. You could then use that variable to decide whether or not to execute the STORE command.

          • Re: STORE after reload
            Sunny Talwar

            I was going to put on the same path of using the Partial Reload functionality. You can do something like this:

             

            IF not IsPartialReload() then

             

                 your originalreload script with your fact table

             

            ENDIF;

             

            IF IsPartialReload() then

             

                 STORE FactTable into ..... qvd (qvd);

             

            ENDIF;

             

            HTH

             

            Best,

            Sunny

              • Re: STORE after reload
                Friedrich Hofmann

                Hi sunindia,

                 

                apparently you already got the PARTIAL RELOAD working?

                I read up on it once, the trigger-words are "REPLACE" and "ADD" in front of a LOAD, no?`

                Otherwise, how do you set the variable that the IsPartialReload() function queries?

                Thanks a lot!

                Best regards,

                 

                DataNibbler

                  • Re: STORE after reload
                    Sunny Talwar

                    I have not tested this particular case where its been used for storing, but since you mentioned I am going to do a test load and come back to let you know if it worked or not.

                     

                    Best,

                    Sunny

                      • Re: STORE after reload
                        Sunny Talwar

                        It is working. PFA a sample qvw file.

                         

                        I think since I am not LOADING a table, I don't need Add or Replace keywords. I am just using an existing table to store into a qvw and hence I don't need those keywords.

                         

                        HTH

                         

                        Best,

                        Sunny

                          • Re: STORE after reload
                            Friedrich Hofmann

                            Hi,

                             

                            OK, I only ever tried with those keywords and it didn't work. But if you haven't got any keywords, how is that variable set that the function IspartialReload() queries? Somehow that has to be set to TRUE or FALSE. How is that done?

                              • Re: STORE after reload
                                Sunny Talwar

                                So when you hit the Partial Reload then it would tell the statement IF IsPartialReload() then to be TRUE and when you do a Regular Reload it would tell it to be FALSE. At least that's how I interpret it.

                                 

                                Best,

                                Sunny

                                  • Re: STORE after reload
                                    Friedrich Hofmann

                                    Hi,

                                     

                                    I don't know that there is an option to reload the script only partially. How can I do that? The regular reload is triggered by hitting Ctrl+R, and the partial one?

                                    Does the user have to decide at the outset what to do?

                                      • Re: STORE after reload
                                        Sunny Talwar

                                        You can use Ctrl + Shift + R or you can use the file menu to do it. Take a look at the image below:

                                        Partial Reload.png

                                          • Re: STORE after reload
                                            Friedrich Hofmann

                                            Ah. Thanks!

                                            That is a good possibility.

                                            And the partial reload keeps all the previously loaded tables in memory?

                                            That's something new to me. Good to know. Then those keywords aren't necessary because when you give a new table a name that already exists, that table will be overwritten and if you have something to concatenate to an existing table, you can use the CONCATENATE () keyword.

                                            Great!

                                            Thanks a lot!

                                              • Re: STORE after reload
                                                Sunny Talwar

                                                That is not true. Anytime you have a load statement you want to use during partial reload, you need a Add or Replace statement otherwise QV will skip the table even with the IF IsPartialLoad() statement in place.

                                                  • Re: STORE after reload
                                                    Sunny Talwar

                                                    I have posted a qvw file which you might find useful. Have a look here:

                                                     

                                                    Re: Is that possible to Append/Add data to QlikView Application based on user request.

                                                     

                                                    Best,

                                                    Sunny

                                                      • Re: STORE after reload
                                                        Friedrich Hofmann

                                                        Ah,

                                                         

                                                        so the two have to go together,

                                                        - the ISPARTIALRELOAD() query at the beginning to enter into one of two branches

                                                        - the keywords ADD or REPLACE

                                                        ?

                                                        I didn't know that.

                                                        But any previously loaded tables are kept in memory, aren't they?

                                                        I'll test that.

                                                        Best regards,

                                                         

                                                        DataNibbler

                                                          • Re: STORE after reload
                                                            Friedrich Hofmann

                                                            Cool!

                                                             

                                                            At first it didn't work at all - but in that app, there was a BINARY LOAD before that construct.

                                                            It also seems that you have to query the

                                                            >> NOT ISPARTIALRELOAD() << first and then the >> ISPARTIALRELOAD() <<, no?

                                                            When I tried on a small dummy file with the ADD keyword, it worked that way round.

                                                              • Re: STORE after reload
                                                                Sunny Talwar

                                                                So let me take a shot at explaining the whole partial reload thing. Lets look at different scenarios:

                                                                 

                                                                Scenario 1:

                                                                Table:

                                                                LOAD *

                                                                FROM xyz;

                                                                 

                                                                Table1:

                                                                NoConcatenate

                                                                LOAD *

                                                                Resident Table;

                                                                 

                                                                DROP Table Table;

                                                                 

                                                                If you do a partial reload first two table loads will not be loaded (since they don't have Add or Replace next to them), but the DROP Table Table statement will execute. Similarly regular or partial reload DROP, LET, SET statements will always run unless you have a IF IsPartialReload() Statement to stop them from running.

                                                                 

                                                                Scenario 2:

                                                                Table:

                                                                Add LOAD *

                                                                FROM xyz;

                                                                 

                                                                Table1:

                                                                NoConcatenate

                                                                Add LOAD *

                                                                Resident Table;

                                                                 

                                                                DROP Table Table;

                                                                 

                                                                Both tables will only run when you do a partial reload and won't run on the regular reload, but the DROP statement will during the regular reload giving you an error that Table doesn't exist.

                                                                 

                                                                Scenario 3:


                                                                Table:

                                                                LOAD *

                                                                FROM xyz;

                                                                 

                                                                IF IsPartialReload then

                                                                     Table1:

                                                                     NoConcatenate

                                                                     Add LOAD *

                                                                     Resident Table;

                                                                 

                                                                     DROP Table Table;

                                                                ENDIF;

                                                                 

                                                                Now the DROP statement will only run when you are doing a partial reload. To answer your question, the tables loaded through a regular reload can be accessed (concatenated to, joined to, resident from, keep to) during the partial reload.

                                                                 

                                                                I hope this would clarify a lot of your doubts (if not all)

                                                                 

                                                                Best,

                                                                Sunny

                                                                  • Re: STORE after reload
                                                                    Friedrich Hofmann

                                                                    Hi sunindia,

                                                                     

                                                                    indeed that clarifies a lot!

                                                                    So if I want the first table to be loaded on a regular reload, but not the second one, while the second one (both in fact) is only loaded in a partial reload, I have to use that IsPartialReload() clause. Otherwise, I can only have both table load on a regular reload or none. At least that seems to be the case. I just tried.

                                        • Re: STORE after reload
                                          nagarjuna k

                                          Hi



                                          if you hit the Partial Reload then it would tell the statement IF IsPartialReload() then to be TRUE and when you do a Regular Reload it would tell it to be FALSE.



                                          Reagrds,

                                          Nagarjuna

                                            • Re: STORE after reload
                                              Friedrich Hofmann

                                              That is a cool tool for the development process.

                                              When you have a script that takes a while to reload and you can tell exactly where there is an error, you only need to reload that bit - so you use that PartialReload() functionality and write the REPLACE keyword just in front of that one LOAD. That way all the others will remain untouched and the whole thing will be a lot faster.