1 Reply Latest reply: Apr 4, 2013 2:34 PM by Juan Olivares RSS

    Script to add column to table

      Hi,

       

      I need to add a new field to and existing table (shown below). The field is calculated using values from the previous record. The problem is that the new field is part of the formula.

       

      The following script gives me this error: '[New Field] does not exist'. Any help would be appreciated.

       

      T1:

      Load

                *,

        if(PeriodID = 1, 1, Previous('[New Field]')-Previous('[Budget Contr]')) as [New Field]

      Resident TableName;

       

       

       

      PeriodIDPeriodBudget AmtBudget ContrNew Field
      1Apr145886.000.07241.0000
      2May178932.000.08880.9276
      3Jun174902.000.08680.8388
      4Jul182962.000.09080.7520
      5Aug188201.000.09340.6612
      6Sep178932.000.08880.5678
      7Oct198880.500.09870.4790
      8Nov196261.000.09740.3803
      9Dec132587.000.06580.2829
      10Jan132587.000.06580.2171
      11Feb145886.000.07240.1513
      12Mar158983.500.07890.0789