Discussion Board for collaboration on QlikView Scripting.
I'm proberly doing something wrong, I have a filename: Commercial_ED_REL_GCPR_272022793_2011-12-29.txt
Where I allready extracted the Ordernumber from by using the following expression:
mid(filename(),Index(filename(),'PR_')+3,9) as OrderNo,
Now I'm trying to add an if statement to it, if the number after 'PR_'starts with 27 then 'True' otherwise 'False'.
This is my expression:
if(mid(filename(),index(filename(),'PL_')+3,2)='27','True','False') as Test,
There must be something wrong with my expression since I only get False as a result.
Hope someone can help
Thanks in advance!
Go to Solution.
Shouldn't you use 'PR_' as second argument to the index function?
I find that too many functions and subfunctions can confuse me so I will generally turn to the Preceeding Load to do this type of thing:
if(Left(OrderNo, 2)=27, 'True', 'False') As Is27,
SubField(filename, '_', 5) as OrderNo,
FileName() as filename
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);
Note that I have used the SubField function to extract the OrderNo - I think that it is a better method if the filename has a fixed structure like this.
Thanks! I'm appearantly not so sharp at the end of the day. lol But
you are right! It should have been 'PR_' instead of 'PL'_.
On donderdag 2 februari 2012 at 6:20 PM, swuehl wrote:
Re: something wrong with my if expression created by
swuehl in Development (QlikView Desktop) - View the full discussion
Thanks Stephen! That to is a very good approch
On donderdag 2 februari 2012 at 6:24 PM, Stephen Redmond wrote:
Stephen Redmond in Development (QlikView Desktop) - View the full