Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
tmumaw
Specialist II
Specialist II

Logic....

Anyone see anything wrong with this:

if(mid(MntPlan_WARPL,1,5) = 'PMH/J',mid(MntPlan_WARPL,1,5),

   if(mid(MntPlan_WARPL,1,5) = 'PMC/D',mid(MntPlan_WARPL,1,5),

      if(mid(MntPlan_WARPL,1,3) = 'PMN',mid(MntPlan_WARPL,1,3),

         if(mid(MntPlan_WARPL,1,3) = 'PML',mid(MntPlan_WARPL,1,3),

           if(mid(MntPlan_WARPL,1,3) = 'PMA',mid(MntPlan_WARPL,1,3)))))) as PM_Type

Thanks

7 Replies
Digvijay_Singh

Looks fine to me syntax wise. What error you are facing?

Clever_Anjos
Employee
Employee

No visible issue.

What is being returned?

Anonymous
Not applicable

Hi Thom.

Seems good to me. What are you trying to achieve and what are the errors you are facing here?

tmumaw
Specialist II
Specialist II
Author

PMA only is being returned

Clever_Anjos
Employee
Employee

It would be possible if you post a sample of your data?

Anonymous
Not applicable

Hi thom,

I'm thinking maybe this is what you are trying to achieve?

if(MID(MntPlan_WARPL, Index(MntPlan_WARPL,'PMH/J'), 5) = 'PMH/J','PMH/J',

if(MID(MntPlan_WARPL, Index(MntPlan_WARPL,'PMC/D'), 5) = 'PMC/D','PMC/D',

if(MID(MntPlan_WARPL, Index(MntPlan_WARPL,'PMN'), 3) = 'PMN','PMN',

if(MID(MntPlan_WARPL, Index(MntPlan_WARPL,'PML'), 3) = 'PML','PML',

if(MID(MntPlan_WARPL, Index(MntPlan_WARPL,'PMA'), 3) = 'PMA','PMA',)))))  as PM_Type

Anil_Babu_Samineni

Might be this

if(mid(MntPlan_WARPL,1,5) = "PMH/J",mid(MntPlan_WARPL,1,5),

   if(mid(MntPlan_WARPL,1,5) = "PMC/D",mid(MntPlan_WARPL,1,5),

      if(mid(MntPlan_WARPL,1,3) = "PMN",mid(MntPlan_WARPL,1,3),

         if(mid(MntPlan_WARPL,1,3) = "PML",mid(MntPlan_WARPL,1,3),

           if(mid(MntPlan_WARPL,1,3) = "PMA",mid(MntPlan_WARPL,1,3)))))) as PM_Type

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful