Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
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
Highlighted

Re: Insert column - Script Qlikview

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
Highlighted

Re: Insert column - Script Qlikview

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

Highlighted

Re: Insert column - Script Qlikview

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;

Highlighted
MVP & Luminary
MVP & Luminary

Re: Insert column - Script Qlikview

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.

Highlighted
qlikviewwizard
Honored Contributor II

Re: Insert column - Script Qlikview

Hi ssaintlouis

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

Highlighted
Not applicable

Re: Insert column - Script Qlikview

Merci