Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
hopkinsc
Partner - Specialist III
Partner - Specialist III

Merging 2 fields together

Hi, i am trying to merge 2 fields together. and call it [Stock Movement Reason]

the fields are:

ModifiedNarrative
[Stock Adj Reason].

An example of the data within each field is

ModifiedNarrative
STK Ordering
STK Goods Received
STK Adjustment

Stock Adj Reason
P/O Manual
P/O Picco
Waste Manual
Waste Picco

I want to combine them to make one list
STK Ordering
STK Goods Received
STK Adjustment
P/O Manual
P/O Picco
Waste Manual
Waste Picco

Can anyone help me to do this please?
Thanks very much

14 Replies
hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Any help on this?

Not applicable

Hi ,

It can be done through Concatenate option.

Please refer the attached file.

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Hi, thanks for your reply,

Here is my script.

LOAD StoreNumber,
StoreDate,
[Stock Movement Reason Code],
// ProductCode,
EANCode AS EAN,
// IssueNumber,
// CommodityGroup,
EmployeeId,
Narrative AS ReasonDescription,
StockQty,
StockValue,
LinesAffected,
CostValueDiff,
RSPValueDiff,
StoreTime,
%LkStoreReasonCode,
if(wildmatch(Narrative,'Goods*')>0,'GRN (Completed)',
if(wildmatch(Narrative,'Stock*')>0,'STKVAR Stock Checking',
if(wildmatch(Narrative,'Ordering*')>0,'STKADJ Ordering Screen',
if(wildmatch(Narrative,'Order Main*')>0,'STKADJ Order Maintenance')))) as ModifiedNarrative

FROM $(cFileName) (qvd);

ENDIF

SET cFileName = $(RetailPath)StoreReasonCode.qvd;
IF QvdCreateTime('$(cFileName)') >= 0 THEN

StoreReasonCode:
Join LOAD [Stock Movement Reason Code],
ReasonDescription,
ReasonDescription & ' - ' & [Stock Movement Reason Code] AS [Stock Adj Reason]

FROM $(cFileName) (qvd);

The ModifiedNarrative is on the last line of the 1st table and Stock Adj Reason is the last field of the 2nd table.

How would i write this into the script please?

Not applicable

Can you please share your QVW file.....

Also you can refer the concatenate section in the reference manual.

prieper
Master II
Master II

Within your scipt you merge two table with JOIN-command on one keyfield.
Further calculations (like the required concatenation) have then to be done by creating a new table.

Table1: LOAD Key, Field1.... FROM ....;
JOIN (Table1) LOAD Key, Field2 .... FROM ....;
NewTable: LOAD Field1&Field2, ... RESIDENT Table1;
DROP TABLE Table1;


HTH
Peter

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Hi Peter, thanks for your reply.

Is there any chance you could post a sample of what you mean, I have tried doing what you have said but it keeps failing...

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Does anyone have an example of this please??

Not applicable

Can you please share your QVW file...............

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Hi XXX, Thanks for your reply.

Attached is my QVW.

In the load script i want to join together:

TABLE: storestockmovement (This has a join to another table and is called 'StockMovementSales')

FIELD: Narrative

and

TABLE: StoreReasonCode

FIELD: [Stk Adj Reason] (Which is a renamed field. If this can't be done then instead of [Stk Adj Reason], use ReasonDescription

and i would like to call the joined field 'Adj Reason'

Thanks