Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
fonsosurfer
Contributor
Contributor

nested If optimization

Hi, Goog morning!

I'm trying to optimize an IF statement that I have in a Load. This is my IF expression:

LOAD

Grupo1,

Original1,

if(Original1 <> 'Anything',  // = 'N/A',

If (substringcount (upper(Grupo1),'N1') > 0, 'N1',

If (substringcount (upper(Grupo1),'N2')>0 or substringcount (upper(Grupo1),'N3')>0 or substringcount (upper(Grupo1),'N4')>0, 'Nsw',

If (substringcount (upper(Grupo1),'OLC') > 0 or substringcount (upper(Grupo1),'LCO') > 0 or substringcount (upper(Grupo1),'IMPL') > 0, 'Implantación'   ,

If (substringcount (upper(Grupo1),'GESTION DE CAMBIOS') > 0 or substringcount (upper(Grupo1),'GESTIÓN DE CAMBIOS') > 0

or substringcount (upper(Grupo1),'CHANGE MANAGEMENT') > 0 or substringcount (upper(Grupo1),'SUPPORT & DEPLOYMENT') > 0

or substringcount (upper(Grupo1),'GDC') > 0, 'GGCC'   ,

  'Otros'

  )

  )

    )

)

,Original1 ) as Nivel1

RESIDENT

TABLA1;

Any suggestion?

Thanks a lot!!!

1 Solution

Accepted Solutions
effinty2112
Master
Master

Hi Alfonso,

You could try this to see if it's quicker:

LOAD

Grupo1,

Original1,

if(Original1 <> 'Anything',  // = 'N/A',

Pick(1+Wildmatch(upper(Grupo1),'*N1*','*N2*','*N3*','*N4*','*OLC*','*LCO*','*IMPL*','*GESTION DE CAMBIOS*','*GESTIÓN DE CAMBIOS*','*CHANGE MANAGEMENT*','*SUPPORT & DEPLOYMENT*','GGCC'),

'Otros','N1','Nsw','Nsw','Nsw','Nsw', 'Implantación', 'Implantación', 'Implantación', 'GGCC', 'GGCC', 'GGCC', 'GGCC', 'GGCC')

)

,Original1 ) as Nivel1

RESIDENT

TABLA1;

Cheers

Andrew

View solution in original post

5 Replies
vishsaggi
Champion III
Champion III

What is the problem with your current IF is it taking lot of time?

ziadm
Specialist
Specialist

Try to Use ApplyMap instead .. if you are able to map Grupo1 Field to



N1

N2

Nsw

Implantación



This would be more efficient and do not have to change the code

effinty2112
Master
Master

Hi Alfonso,

You could try this to see if it's quicker:

LOAD

Grupo1,

Original1,

if(Original1 <> 'Anything',  // = 'N/A',

Pick(1+Wildmatch(upper(Grupo1),'*N1*','*N2*','*N3*','*N4*','*OLC*','*LCO*','*IMPL*','*GESTION DE CAMBIOS*','*GESTIÓN DE CAMBIOS*','*CHANGE MANAGEMENT*','*SUPPORT & DEPLOYMENT*','GGCC'),

'Otros','N1','Nsw','Nsw','Nsw','Nsw', 'Implantación', 'Implantación', 'Implantación', 'GGCC', 'GGCC', 'GGCC', 'GGCC', 'GGCC')

)

,Original1 ) as Nivel1

RESIDENT

TABLA1;

Cheers

Andrew

Kushal_Chawda

If you can share the sample data, it will be helpful to give you more optimized way to do this

fonsosurfer
Contributor
Contributor
Author

I think so. Im having a message error: "allocated memory exceeded". Probably is because de Ifs