cancel
Showing results for 
Search instead for 
Did you mean: 

IF Conditions

jean_almeida
Explorer
0 Kudos

Hello buddies,
Can you help me? I'd like to compare two attributes from different dimensions in an advanced formula data action. But not working, return this error message: "Dimension attribute [d/ESTABELECIMENTO].[p/ESTAB_FORN] cannot be used in a IF conditional"

IF [d/ESTABELECIMENTO].[p/ESTAB_FORN] != [d/SKU].[p/ESTAB_PROD] THEN

View Entire Topic
N1kh1l
Active Contributor

jean.almeida

Currently SAC does not allow to use property comparison on both sides in IF operator in AF. You can try the below workaround which I advised on a related question.

https://answers.sap.com/questions/13840337/can-i-compare-attributes-values-in-data-action.html?child...

Hope this helps !!

Nikhil

jean_almeida
Explorer
0 Kudos

Nikhil Anand,

I tried your suggestion, but it didn't work completely. Although the error disappeared, I still can't save.

N1kh1l
Active Contributor
0 Kudos

jean.almeida

It used to work like this but I was able to recreate this error. Assuming both your attributes are of type integer, try the below , just Add INT before attribute function and it will save.

IF [d/SAP_CEP_SALESORG].[p/Property1]=INT(ATTRIBUTE([d/SAP_CEP_ENTITY].[p/Property2])) THEN
	DATA()=1 // sample
ENDIF

Hope this helps !!

Please upvote/accept if this helps

Nikhil

jean_almeida
Explorer
0 Kudos

Thanks for the suggestion, it worked!

Appreciate the help!

N1kh1l
Active Contributor
0 Kudos

jean.almeida

Great. Request you to please close the thread by accepting the right answer.

Nikhil