Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

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.
Valued Contributor II

Help with script...

Hi everyone..

I am trying to do something in my script but am unsure how to..

I am loading in a table and two of the fields contained in the table are :


[Stock Movement Reason Code]

Narrative contains a mixture of system generated descriptions and user generated descriptions for stock movements

i.e. Wastage, Stock Checking, Goods Receiving, Goods Returned etc

Most stock actions (e.g. Wastage) have been assigned with their own Stock Movement Reason Codes (Wastage is 3), but some actions (e.g. Stock Checking, Goods Received) do not have their own code, so the system allocates a ZERO to them.

Any SYSTEM allocated ZERO narrative will also have the date, time and user appended to the data.

i.e. Stock Checking Variance, Mike, 20/05/11 14:21:24 whereas all other Stock Movement Reason Codes (Greater than ZERO) would be:  Stock Checking Variance (with no date /time stamp)

In my app i can report all reason codes greater than ZERO, but i now want to show system codes (ZERO) also.

I want to change the ZERO's to show a made up code instead.

i was thinking of using a wildmatch if statement to say something like...

if narrative = stock checking* give [Stock Movement Reason Code] 999

if narrative = Goods Rece* give [Stock Movement Reason Code] 888


So then i can select 999 and ALL stock checking variances will show.

At the moment if i select [Stock Movement Reason Code] 0 the all system generated narratives will appear.

Can anyone help??

2 Replies
Valued Contributor II

Re: Help with script...

Anyone have any ideas?


Re: Help with script...


Not sure what your question is. I think you are asking for help on how script the wildmatch statements...

Perhaps something like this as a line in a LOAD:

Pick(WildMatch(narrative, 'stock checking*', 'Goods Rece*')+1  , [Stock Movement Reason Code], 999,888) As [new Stock Movement Reason Code]

The +1 allows the expression to return the [Stock Movement Reason Code] value if there is no match.

Hope that helps


Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Community Browser