Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys,
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!
Carter
Shouldn't you use 'PR_' as second argument to the index function?
Shouldn't you use 'PR_' as second argument to the index function?
Hi,
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:
Load
if(Left(OrderNo, 2)=27, 'True', 'False') As Is27,
*;
Load
SubField(filename, '_', 5) as OrderNo,
*;
LOAD Field1,
Field2,
Field3,
FileName() as filename
FROM
[Commercial_ED_REL_GCPR_272022793_2011-12-29.txt]
(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.
Regards,
Stephen
Hi Stefan,
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'_.
Carter
On donderdag 2 februari 2012 at 6:20 PM, swuehl wrote:
QlikCommunity
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:
QlikCommunity
Re: something wrong with my if expression created by
Stephen Redmond in Development (QlikView Desktop) - View the full
discussion