1 Reply Latest reply: Sep 7, 2011 1:29 PM by Fernando Suzuki RSS

    Script reuse

      Hey people,

       

      I am trying to build a dashboard which could get the table from some database updated every month. So I have loaded the data of last three month like the chart below:

      My script is like

       

      Directory;

      LOAD Date,

           June AS M1,

           July AS M2,

           August AS M3

      FROM

      test1.xls

      (biff, embedded labels, table is Sheet1$);

       

      However, the Loading is hard coded. Thus if i want to reload the data table test1 this month, which is updated with information of July, August and Septmber, my reload will fail.

       

      Wondering if there is a way that I can make it work monthly?

       

      Thanks in advance!

       

      Best,

      Thomas

        • Script reuse
          Fernando Suzuki

          Hi,

           

          for the dynamic months, I think you can use something like this:

           

          let M3 = date(today(), 'MMMM');

          let M2 = date(addmonths(today(), -1), 'MMMM');

          let M1 = date(addmonths(today(), -2), 'MMMM');

           

          load Date,

                 $(M3) as M3,

                 $(M2) as M2,

                  $(M1) as M1

          FROM test1.xls (biff, embedded labels, table is Sheet1$);

           

           

           

          Hope this helps you.

          Regards,

          Fernando