Cross columns validation


(Ra Li) #1

Hi, I’m looking to check if “FIELD_A” has a value of “1” then “FIELD_B” shouldn’t be null.

What is the best way to perform this “Validations” check in RDM?

Thanks in advance,


(Danny Ryan) #2

Hi Ra Li,

pur_column_a = ‘1’ and pur_column_b is not null

Attached is a plan demonstrating the validation rule.

Hope this helps

DannyRaLi_Column_Validation.plan (4.0 KB)


(Ra Li) #3

Hi Danny- Thanks for your response. I’m trying to build that in the validation screen under the RDM Logical Model “Validations” tab. I have a rule similar to the one you have noted below, however it’s causing issues when uploading the config zip file.

Please let me know if additional information is needed.


(Danny Ryan) #4

Hi Ra Li, are you able to share the table columns and validations?

I’d place this type of validation under Expressions.

Thanks
Danny


(Ra Li) #5

That’s exactly where I have it.

Essentially, ‘comments’ field must be populated if the ‘validation’ = ‘Data Error’.


(Danny Ryan) #6

Whats the error on the admin/console during upload?


(Ra Li) #7

It’s almost like it’s causing an issue when restarting as the ‘validation’ field should equate to ‘Data Error’ and ‘comments’ should be null is I think how it’s reading it. Below is a sample from the log file:

2018-07-06 15:30:13 WARNING: Row in table 'asset with id:‘28’ has errors: 'Global messages:
Comment field must be populated if the entry has a Data Error
'.
2018-07-06 15:30:13 WARNING: Row in table 'asset with id:‘29’ has errors: 'Global messages:
Comment field must be populated if the entry has a Data Error
'.
2018-07-06 15:30:13 WARNING: Row in table 'asset with id:‘30’ has errors: 'Global messages:
Comment field must be populated if the entry has a Data Error
'.
2018-07-06 15:30:13 WARNING: Row in table 'asset with id:‘31’ has errors: 'Global messages:
Comment field must be populated if the entry has a Data Error

Reversing the criteria won’t help either… for example making it ( <> ‘Data Error’ and NOT NULL)


(Danny Ryan) #8

Looks like you have 4 invalid records already present in the asset table.
RDM wont boot whilst they are invalid.
What version of RDM do you have. Can you enter repair mode to see and edit these records in the rdm web app. Either remove them or change them so they are valid.
Once the invalid records are made valid rdm will boot normally.

Let me know how you get on.
Danny


(Ra Li) #9

These records are null for both fields. technically, they shouldn’t error out. This is also true after I test the expression which returns as ‘false’. The expression shouldn’t apply to anything that doesn’t equal to ‘Data Error’. I’m looking to only apply this criteria when the ‘validation’ = ‘Data Error’ if yes, then the ‘comments’ should be populated.


(Danny Ryan) #10

In the expression validation. Cover all of your permitted value rules

A=‘Data Error’ and B is not null. // TRUE
Or
A=null and B=null // TRUE

Try this change and the records in your table will be valid when
Data error and comment are populated
Or both are null.

Any othe combination will be invalid.

Danny


(Ra Li) #11

Thanks for the suggestion. I did use an expression for all the different scenarios and it keeps failing as well.


(Katrin Popova) #12

Hello Ramzi,

Does the issue still persist? Can you provide details? Do you need assistance or it is already resolved?

Regards,
Katrin


(Ra Li) #13

Hi Katrin- This issue hasn’t been resolved yet.

I’m looking to understand if I can make a check if “FIELD_A” has a value of “1” then “FIELD_B” shouldn’t be null.

Thanks,


(Katrin Popova) #14

Hello Ramzi,

Where are you specifying the validation, is in tables in Validations tab or somewhere else? Could you please provide me more details and screenshots?

Regards,
Katrin


(Ra Li) #15

Hi Katrin- Yes, this is at the Validations field for the table. I have a table with FIELD_A and FIELD_B. When FIELD_A = ‘xyz’ then FIELD_B shouldn’t be null. If null show an error message, if not, remove error message.

Thanks,


(Ra Li) #16

This issue has been resolved using a CASE statement in the column validation.


(Katrin Popova) #17

Thank you for sharing the solution, Ramzi.

Katrin