3 Replies Latest reply: Jun 29, 2011 7:37 AM by Miguel Angel Baeyens de Arce RSS

    Loading Data via button?

      Hi,

       

      i try to write a macro that loads the script with variable data. but I don't have any idea.

       

      The user should click the button, after that choose to different dates and all data between these dates will be loaded.

       

      e.g.

      by starting the document all data between the 1.1.2011 and 31.12.2011 will be loaded, but the user should be able to use another period by clicking the button.

        • Loading Data via button?
          Miguel Angel Baeyens de Arce

          Hi,

           

          Wouldn't it be better to have a selection when the user opens the document so all data is available but only the selected dates are shown? I mean, it may take a lot of time to continuously reload the document depending on user selections when you can have a similar result using bookmarks or something similar.

           

          Hope that helps.

           

          Miguel Angel Baeyens

          BI Consultant

          Comex Grupo Ibérica

            • Loading Data via button?

              thanks for that advise. that seems to be a good solution, but I have another problem with this:

               

              by starting the document, the user should input two dates, after that the script should load the data.

               

              in the script it looks like that:

               

              QV_RESOURCES:

              sql select * from resources where schedule_date <= max and schedule_date >=min;

               

              min and max are variables, but how can I fill them with the data from the user?

                • Re: Loading Data via button?
                  Miguel Angel Baeyens de Arce

                  Hi,

                   

                  Use something like the following

                   

                  // Preceding anything else in the script
                  LET vMin = Input('Input the min value', 'Warning');
                  LET vMax = Input('Input the max value', 'Warning');
                  
                  Data:
                  LOAD * INLINE [
                  Field, Value
                  A, 1
                  B, 2
                  C, 3
                  D, 4
                  E, 5
                  ]
                  WHERE Value >= $(vMin) and Value <= $(vMax);
                  

                   

                  Every time you reload, you will be prompted for a min and max values and they will be stored in variables and used in the WHERE clause on the LOAD.

                   

                  It won't work in a server enviroment since the users cannot reload the document.

                   

                  Hope that helps.

                   

                  Miguel Angel Baeyens

                  BI Consultant

                  Comex Grupo Ibérica