Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

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
Master III
Master III

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