4 Replies Latest reply: May 25, 2017 7:58 AM by Mark Ritter RSS

    Script Help

    Mark Ritter

      I have an inline table that I load that has a field called 'Value' that contains a target or goal.

       

      I then load my data from another source.

       

      The challenge I am having is that I then want to use the Value field from the resident table in an expression with the fields from my other data.

       

      I keep getting an error that it can't find 'Value' when it tries to execute the expression.

       

      The inline table and my data are linked via a key that I create.

       

      I was thinking that I could load each of the tables.  Then combine the 2 resident tables into one table and do the calculation.  But I can't get that to work.

       

      I am at work and don't have the code I was trying to give you an example.  If this is not an obvious answer then I can add that later today.

       

      Thanks

        • Re: Script Help
          Fernando Keuroglian

          Hi

          Please add and example to be easier to help you

           

          Fernando K.

          • Re: Script Help
            Mark Ritter

            Here is the code that I was trying.

             

            This part of the code works.

            But as soon as I add Value from the first Resident table to be part of an expression I get an error that it can't find that field.

             

            Noconcatenate 

             

            MergeTable: 

            LOAD Metric_Key,

                 Value

             

            resident Final_Metrics; 

             

            JOIN (MergeTable)

             

            LOAD *,

               Num(((Num([On Scene Time]) - Num([Pickup Date/Time]))*60*24),'###.00') as Response_Time

             

             

            resident Run_Data; 

             

            Drop Table Final_Metrics, Run_Data;

            • Re: Script Help
              Mark Ritter

              I actually came up with a solution that works.

               

              I just added another resident load at the end of the MergedTable and then did the calculation that I needed there.  I don't know if that is the best way to do it.  But it worked for me. 

               

              I don't have a massive amount of data to deal with.  So I don't have to be too concerned about being efficient.