cancel
Showing results for 
Search instead for 
Did you mean: 

Validation expression, with a Boolean field

Former Member
0 Kudos

Hello,

My issue is as follow: I want to make sure that if attribute 'A' = "1"; then attribute 'B' has values.

Note: attribute 'A' is boolean.

I did not succeed in setting up such a formula [I succeeded in setting up the opposite formula only:

IF(Attribute 'A',IS_NULL(Attribute B))

]

Thx for any help,

Rémi Dusaud

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

As you said that I want to make sure that if attribute 'A' = "1"; then attribute 'B' has values.

I tried with this below expression

IF(attribute 'A' = "1", IS_NOT_NULL(attribute 'B'))

where attribute 'A' is boolean field.

This expression is working fine at my end.

Revert with result and let me know if you still face any issue.

Regards,

Mandeep Saini

Former Member
0 Kudos

Hi,

Thank you Mandeep, I also tried this formula this morning, but it did'nt work: can this come from the fact that my boolean attribute values are 'text' values and not 'integer' values?

Regards,

Rémi Dusaud

Former Member
0 Kudos

Hi Remi,

attribute 'A' is a field of type Boolean in main table, right which has two values 1 and some other value, right?

if this is right then i hope you have also set True Value as 1 and False Value as something in MDM Console. Because Boolean field has only two values which you can set through Console by default True value = TRUE and False Value = FALSE, here you need to change it to 1 and other value as per your requirement.

For the same this expression works as given by me in above post.

If this is really Attributes, name as Attribute 'A' and Attribute 'B' in taxonomy mode of data manager.

and by Boolean you mean here that Attribute of type Text but has two values 1 and some other value.

if this is true then you want a record in maintable is associated with a category which is linked with these two Attributes, and if Attribute 'A' has Attribute Value as 1 then Attribute B should not be null, in this case firstly you have to create a validation and then right click on this validation and then Add Branch select here Branch Value(category which is linked with these two attributes). a new validation gets created with this branch Value.

now write expression in this Branch validation expression as same:

IF(attribute 'A' = "1", IS_NOT_NULL(attribute 'B'))

But here you need to select Attribute 'A' and Attribute 'B' from Attributes Tab in validation expression.

and select "1" from Text Values Tab in validation expression.

let me know if you still face, in both ways this expression is working fine at my end.

Regards,

Mandeep Saini

Former Member
0 Kudos

Hi Mandeep,

I apologize, I wrote 'Attribute' (french word), and I should have written 'Field' (to be compliant with SAP MDM objects).

Let me tell it again:

- Field 'A': is boolean type, with the 2 following values: 'Organic' or 'Non-organic'

- Field 'B': is text type, and must have a value IF Field 'A' = 'Non-organic'.

Note: Both fields belong to the Main table; SAP MDM version 7.1 (SP 2)

Thx a lot for your concern,

Regards,

Rémi Dusaud

Former Member
0 Kudos

Hi Remi,

I hope your expression is working fine now.

As you said, Field 'A': is boolean type, with the 2 following values: 'Organic' or 'Non-organic'

Field 'B': is text type, and must have a value IF Field 'A' = 'Non-organic'.

I hope you have set these two values as True Value as Organic/Non-organic and False Value as Non-organic/organic in MDM Console. This expression is working fine at my end.

IF(Field 'A' = "Non-organic", IS_NOT_NULL(Field 'B'))

This should work at your end too,

Make sure that words you type Non-organic within double quotes in expression should be exactly same

(case sensitive) as you write in MDM Console.

Regards,

Mandeep Saini

Former Member
0 Kudos

Hi Mandeep,

Correct! Everything's ok!

Regards,

Rémi Dusaud

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Remi

For the boolean field A reverse the values defined in console.

If now true value=1, False=x change this to TRUE=x and FALSE=1.

Then the same expression below will give you the desired results.

IF(ATTRIBUTE 'A' , IS_NULL(ATTRIBUTE 'B'))

best regards

Ravi

Former Member
0 Kudos

Hi Ravi,

Unfortunately, the case is a little more complex (but I didn't explain it completely in my previous posts):

Note:

Field 'A' (boolean in Main table) = 'Organic' / 'Non-organic'

Rules :

- If Field 'A' = 'Non-Organic', then Field 'B' must have a value

- But if Field 'A' = 'Organic', then Field 'B' can have a value OR not

Thx for your help,

Regards,

Rémi Dusaud