4 Replies Latest reply: Apr 16, 2012 1:09 AM by Rob Wunderlich RSS

Could someone explain Preceding load ?

Balraj Prabhu

Hi all,

on

  I went through the defination for preceding load , but could not clearly understand it, could some attacch a sample qvw explaing preceding load.

 

 

Thanks

B

  • Could someone explain Preceding load ?
    Celambarasan Adhimulam

    Hi,

         Preceding load means performing a load operation in the loaded table.

         TableName:

         Load *, Sal*0.10 as Tax;

         Load * Inline

         [EmpID,Sal

         1,200000

         2,330000

         3,500000

         4,688998

         7,346373];

    In this you ignore one field or you can add one more field based on another field(from the loaded).

     

    Celambarasan

  • Could someone explain Preceding load ?
    JOSE MARIA TOS MIÑANA

    Hi,

     

    I think it´s very usefull when you want to add calculated fields in the same table you are loading, for example:

     

    TABLEX:

    Load

    A,

    B,

    C,

    A-B*C as D,

    D+A as E

    From table.xls;

     

    This code gets you an error because D is not avaible yet, so you can use the Preceding load like this:

     

    TABLEX:

    Load * ,

    D+A as E

    ;

    Load

    A,

    B,

    C,

    A-B*C as D

    From table.xls;

     

    Now you can use field D that is created by operations with the other fieds.

     

    Chema

  • Re: Could someone explain Preceding load ?
    Barry Sarcich

    Preceding load allows loading of extra derived fields on top of an already loaded table. As stated it allows the derivation of new fields based on previously derived fields without having to do a new load of the entire table.

     

    If we load data from a file as such.

     

    RAW_DATA:

    Load

         A,

         B,

         C

    From DATA.qvd;

     

     

    Then we want to derive a new field D, but then we also want to derive a new field based on the result of D, then you can do a preceding load as such.

     

    MAIN_TABLE:

    Load

         *,

         IF(D = 1, 'Category 1',

           IF(D = 2, 'Category 2',

           IF(D = 3, 'Category 3', 'Unknown Category'))) As Category

    ;

    Load

         *,

         (A + B) / C As D

    Resident RAW_DATA;

     

     

    It is also useful for creating key fields that contain a number of derived fields since it is extremely difficult to put a bunch of fields derived with IF statements into a single field. You can also stack more preceding loads above other preceding loads so you can derive a field from fields derived in preceding loads below it.

     

    Note that preceding load breaks optimized load though. So if you load the actual .qvd field and put a preceding load before it, the .qvd will no longer load optimized.