5 Replies Latest reply: Feb 4, 2015 6:19 AM by Manuel Carmona RSS

    Help with variable NULL value

    Manuel Carmona

      Hi Community,

       

      I have a problem with a variable whichI don't know why is set to NULL.

       

      The situation is as follows.

       

      1. I have a date field from table GA

      2. I have a second date field from table PS

      3. What I want to get is the most recent date of the two fields, then compare them and keep the biggest one, i.e. the most recent date in numeric format

      4. What I've done is to load the two fields and use two different variables MaxDate_1 and MaxDate_2 to store the biggest (most recent) date of the two differente fields. After that I wanted to use a third variable to store the maximum of MaxDate_1 and MaxDate_2 and here is where the problem comes.

      I've checked the variables and MaxDate_1 and MaxDate_2 store numeric values (it seems that part works) but MaxDate is ends up being NULL

      5. Could you please check the end line and tell me if there is any syntax mistake?

       

      Thanks in advance.

      ---

       

      GA:

      LOAD

          "Date"

      FROM [xxx];

       

      PS:

      LOAD

          invoice_date

      FROM [xxx];

       

      Temp:

      LOAD

          Max("Date") as MaxDate_1

          Resident GA;

          LET vMaxDate_1 = floor(peek('MaxDate_1'));

      Drop Table Temp;

       

      Temp:

      LOAD

          Max("invoice_date") as MaxDate_2

          Resident PS;

          LET vMaxDate_2 = floor(peek('MaxDate_2'));

      Drop Table Temp;

       

      Drop Table GA;

      Drop Table PS;

       

      LET vMaxDate = if(MaxDate_1>MaxDate_2,MaxDate_1,MaxDate_2);