Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
siva0606
New Contributor II

Production Vs Manufacturing Issue

Hi all,

I have a "HL" type code in Production table

and "S"type code in Manufacturing table

Both Prod and MFG is linked by ItemCodekey(ItemCode&'-'&Year&'-'&Month)

Production:

ItemCodeProductionQty
WNU012H268542
WNU012L27517
VNU012H21780
VNU012L20764

Manufacturing:

ItemCodeManufacturing Qty
WNU012S28063
VNU012S21511

Most important is I need to split the Item Code in MFG table

WNU012S as WNU012H and WNU012L

Similarly,VNU012S as VNU012H and VNU012L and both H and L should get the same value of S

and my final table should look like this

ItemCode
ProductionQty
Manufacturing Qty
To be Packed
WNU012H2684228063-1221
WNU012L2751728063-546
VNU012H2178021511269
VNU012L2076421511-747

FYI: To be Packed= ProdQty-MFGQty

With Kind Regards,

Shiva

1 Solution

Accepted Solutions

Re: Production Vs Manufacturing Issue

Try this code, you can optimize it with a loop but it works as is:

Production:

LOAD * Inline

[ItemCode,ProductionQty

WNU012H,268542

WNU012L,27517

VNU012H,21780

VNU012L,20764

]
;



Manufacturing_tmp:

NoConcatenate

LOAD * Inline

[ItemCode,ManufacturingQty

WNU012S,28063

VNU012S,21511

]
;



Manufacturing:

NoConcatenate

LOAD

if(right(ItemCode,1)='S',left(ItemCode,len(ItemCode)-1) & 'H',ItemCode) as ItemCode,

ManufacturingQty

Resident Manufacturing_tmp;     



Concatenate



LOAD

if(right(ItemCode,1)='S',left(ItemCode,len(ItemCode)-1) & 'L',ItemCode) as ItemCode,

ManufacturingQty

Resident Manufacturing_tmp;     



DROP Table Manufacturing_tmp;

2 Replies

Re: Production Vs Manufacturing Issue

Try this code, you can optimize it with a loop but it works as is:

Production:

LOAD * Inline

[ItemCode,ProductionQty

WNU012H,268542

WNU012L,27517

VNU012H,21780

VNU012L,20764

]
;



Manufacturing_tmp:

NoConcatenate

LOAD * Inline

[ItemCode,ManufacturingQty

WNU012S,28063

VNU012S,21511

]
;



Manufacturing:

NoConcatenate

LOAD

if(right(ItemCode,1)='S',left(ItemCode,len(ItemCode)-1) & 'H',ItemCode) as ItemCode,

ManufacturingQty

Resident Manufacturing_tmp;     



Concatenate



LOAD

if(right(ItemCode,1)='S',left(ItemCode,len(ItemCode)-1) & 'L',ItemCode) as ItemCode,

ManufacturingQty

Resident Manufacturing_tmp;     



DROP Table Manufacturing_tmp;

siva0606
New Contributor II

Re: Production Vs Manufacturing Issue

It works.Thank you so much.

Community Browser