Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
carolin01
Partner - Creator II
Partner - Creator II

if(mid( statement

Hello,

Could anybody help me with this statement:

if(mid(BaseItem,10,3) = 'D60', '',

if(mid(BaseItem,10,1) = ('H' or 'T' or 'F' or 'V'), mid(BaseItem,11,2), 'Invalid')) as Lenght,

An example for the BaseItem could be H20. But Qlik View is only showing "Invalid". I also tried without the brackets around 'H' or 'T' or 'F' or 'V' but then I get a correct result only for the first value in line, which means if it H20, then it´s correct but if it is F20 then it shows "Invalid" again. Do I have to write an if statement for each of the letters?

Best regards

Carolin

1 Solution

Accepted Solutions
alexandros17
Partner - Champion III
Partner - Champion III

you can write

if(mid(BaseItem,10,3) = 'D60', '',

if(wildmatch(mid(BaseItem,10,1), 'H','T','F','V'), mid(BaseItem,11,2), 'Invalid')) as Lenght,

View solution in original post

4 Replies
alexandros17
Partner - Champion III
Partner - Champion III

you can write

if(mid(BaseItem,10,3) = 'D60', '',

if(wildmatch(mid(BaseItem,10,1), 'H','T','F','V'), mid(BaseItem,11,2), 'Invalid')) as Lenght,

santharubban
Creator III
Creator III


Carolin,

Try this

if((mid(BaseItem,10,1) = ('H' ) or mid(BaseItem,10,1) = ('T)' or mid(BaseItem,10,1) =( 'F') or mid(BaseItem,10,1) =( 'V')), mid(BaseItem,11,2), 'Invalid')) as Lenght,

or

if(match(mid(BaseItem,10,1) , 'H' , 'T' , 'F' ,'V'), mid(BaseItem,11,2), 'Invalid')) as Lenght,

i think this will help you.

MK_QSL
MVP
MVP

if(mid(BaseItem,10,3) = 'D60', '', if(Match(mid(BaseItem,10,1),'H' , 'T', 'F' , 'V'), mid(BaseItem,11,2), 'Invalid')) as Lenght,

carolin01
Partner - Creator II
Partner - Creator II
Author

Wildmatch is perfect for this context!! Thank you!