Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
carolin01
Luminary Alumni
Luminary Alumni

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
Luminary Alumni
Luminary Alumni
Author

Wildmatch is perfect for this context!! Thank you!