Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

paulyeo11
Valued Contributor II

record in SQL it is possible making use of mapping ?

Hi All

Below is my SQL script with is working fine for record kode_reject :-

CONNECT TO [Provider=SQLOLEDB.1;Persist Security Info=False;User ID=SA;Initial Catalog=andonDatabas;Data Source=Paul;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=PAUL;Use Encryption for Data=False;Tag with column collation when possible=False];

LOAD *,

day(date_time)      as [day],

year(date_time)      as [Year],

Date(Monthstart([date_time]), 'YY MMM') as YearMonth,

Pick(Match(kode_reject, 5, 39), 'reject human error', 'reject machine error') AS DESC_REJECT;

SQL select * from record_reject_detail_plc;

In my actual application , i hv more then 100 error code , it is possible to create table like below :-

SegmentTypeMap:

MAPPING LOAD * INLINE [

Original, New

5,reject human error

39,reject machine error.

];


Instead of long list of script :-

Pick(Match(kode_reject, 5, 39), 'reject human error', 'reject machine error') AS DESC_REJECT;


Hope some one can advise how to achieve this ?


Paul

1 Reply
anbu1984
Honored Contributor III

Re: record in SQL it is possible making use of mapping ?

It's better to use mapping load instead of Pick() and Match()

Community Browser