2 Replies Latest reply: Dec 10, 2012 10:41 AM by Martina Dambrosio RSS

    Best way to calculate a new field

      I have two .qvw : GetData.qvw (load data from SQL DB creating qvd) and ShowData.qvw (load data from qvd and prepare data to be presented).

       

      In the SQL DB there are two tables that I import creating two distinct qvd(s): table1.qvd and table2.qvd.

       

      In the ShowData.qvw I have to load the two qvd(s)

       

      Table1:

      (

      Key,

      A,

      )

       

      Table2:

      (

      Key,

      B,

      ….

      )

       

      In the ShowData.qvw I would have a calculated field C = A-B, for all the rows in Table1 (left join).

       

      I did as follow:

       

      Table:

      LOAD

      Key,

      A,

      From table1.qvd;

       

      Left join

      LOAD

      Key,

      B,

      ….

      From table2.qvd;

       

      NewTable:

      LOAD *

      C=A-B

      Resident Table;

       

      And it works, but I'm not sure that this is the best way to do it as it requires loading the data a second time in order to do the calculation.

      Can someone help?

       

      Many Thanks