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

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 :

Narrative

[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

etc

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
hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Anyone have any ideas?

jonathandienst
Partner - Champion III
Partner - Champion III

Chris

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

Jonathan

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