Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Insert column - Script Qlikview

Hi,

How can I insert a column with values replacing one letter values in column 'PurcharseOrderTypeLine' :

Ex : P = Purchase

       F = Force

       S = Sale, ect....

      

Thx in advance

1 Solution

Accepted Solutions
settu_periasamy
Master III
Master III

Hi,

May be try this..

Load YourFields,

  if(PurcharseOrderTypeLine='P','Purchase',

       if(PurcharseOrderTypeLine='F','Force',

            if(PurcharseOrderTypeLine='S',Sale))) as PurcharseOrderTypeLine

Resident [YourtableName];

View solution in original post

5 Replies
settu_periasamy
Master III
Master III

Hi,

May be try this..

Load YourFields,

  if(PurcharseOrderTypeLine='P','Purchase',

       if(PurcharseOrderTypeLine='F','Force',

            if(PurcharseOrderTypeLine='S',Sale))) as PurcharseOrderTypeLine

Resident [YourtableName];

sunny_talwar

You can use a Mapping Load as it seems that you may have multiple PurchaseOrderTypeLine and doing it with if can be a hassle

MappingTable:

MAPPING

LOAD PurcharseOrderTypeLine,

          Description

FROM Excel;


or you can do a Inline Load also


Fact:

LOAD allFields,

          ApplyMap('MappingTable', PurcharseOrderTypeLine) as PurcharseOrderTypeLine1

FROM Source;

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

Load *,

  if(PurcharseOrderTypeLine='P','Purchase',

       if(PurcharseOrderTypeLine='F','Force',

            if(PurcharseOrderTypeLine='S', 'Sale', 'N/A'))) as PurchaseOrderType     

From DataSource;

OR the better way

Load *,

  Pick(Match(PurcharseOrderTypeLine, 'P', 'F','S', '*'), 'Purchase','Force', 'Sale', 'N/A') AS PurchaseOrderType     

From DataSource;


Efficient way:

LOAD

*

FROM DataSource;


Now create an Excel with below details

PurcharseOrderTypeLine, PurchaseOrderType     

P, Purchase

F, Force

S, Sale


Now load this Excel file, this tables joins with the existing table based on PurcharseOrderTypeLine column, if in future there is any new value just add a new record in the Excel file.


Hope this helps you.


Regards,

Jagan.

qlikviewwizard
Master II
Master II

Hi ssaintlouis

Can you attach the sample file along with dummy data. It will help the folks to give quick solution. THanks.

Not applicable
Author

Merci