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

Dude with the sentence if elseif end

Hello,

I have a problem with a script, I have 3 types of object types of wich i have to do a option list for each of them and bring them together in a simple field.

I want to use the "if elseif" clause, but i don´t find help text.

Can you help me?

Here is my script:

     	If([Obj Type Base] = '18' And CardType = 'S' And GroupCode = '122',
     	'Disposición de Créditos',
     		If([Obj Type Base]= '24',
     			If([Cuenta Contrapartida] = '1113-01-00',
     			'Devolución de IVA',
     				If(WildMatch([Cuenta Contrapartida], '1107-04-18','1107-04-04', '1107-04-26', '1107-04-27', '1107-04-28') Or [Cuenta Contrapartida] like '1107-03-*',
     				'Devolución Prestamos de Filiales',
     					If([Cuenta Contrapartida] = '3101-04-00',
     					'Estrategias',
     						If([Cuenta Contrapartida] = '7201-01-00',
     						'Intereses a Favor',
     							If([Cuenta Contrapartida] Like 'ZA*' Or [Cuenta Contrapartida] Like 'ZB*',
     							'Cobranza Intercompañias',
     								If(CardType = 'C' Or (WildMatch([Cuenta Contrapartida], '2107-01-01', '2107-01-02')),
     								'Cobranza de Ventas',
     						    		If(CardType = 'S' Or ([Cuenta Contrapartida] Like '8102-*' Or [Cuenta Contrapartida] Like '8103-*' Or [Cuenta Contrapartida] Like '8104-*'),
     						    		'Otros Ingresos Varios' ,
											'Otros Inresos Varios'    						    			   						    	
     						    	 
     						    		)						
     								)
     							)
     						)
     					)
     				)
     			)
     		)
     	) As [División Cash Flow Ingresos]

I want to add the third object Type, but when i load, the option doesn't appear in my application

Labels (1)
1 Reply
NW1965
Creator
Creator

It is difficult to answer completely as you have only included the code without the third object in it, so the answer I'm giving just makes an assumption about what you are doing which is a common mistake with if....then....else that has nested if....then...else statements.

If your case if Obj Type Base is 24 then you have a whole other series of if...then...else statements going on, so if you then want to add a new Obj Type Base condition, you need to make sure that you add that condition in the right location, otherwise it never gets there.

Example:

IF(Obj_Type='A',12345,
   IF(Obj_Type='B',23456,
      IF(Obj_Type='C',
         IF(ABC=1,34567,IF(ABC=2,45678,IF(ABC=3,56789))),
         IF(Obj_Type='D',67890)))) AS FieldName

Note that I am closing the nested conditions on Obj_Type=C before I ask the question about Obj_type=D