cancel
Showing results for 
Search instead for 
Did you mean: 

Validation for MDM table Columns using Java api

Former Member
0 Kudos

Hi,

I have an employee table (with columns empno, empname) in MDM. I specified a contraint/validation for MDM column empno that empno should accept only 3 digits. This validation is working perfectly when I add records through MDM client.

But the same is not working when I use to add records using Java api. Think the method is bypassing the validation and accepting records with less than 3 digits also.

Do any one have idea how can I restrict using java api?

Thanks for your time and help.

Thanks & Regards,

Shiva Kumar.

Accepted Solutions (0)

Answers (2)

Answers (2)

KlausDavid
Advisor
Advisor
0 Kudos

Two ideas, which might help :

1) What did you enter for the flag "Automatic execution" for the validation ? None, Warning or Error ? Maybe it helps. when this flag is set to error.

2) The class "ValidateRecordsCommand" can be used to validate records againt a validation. The class "ValidationFailure" can be used to retrieve info about records, that failed the validation.

Regards Klaus

Regards Klaus

Former Member
0 Kudos

Hi Shiva,

I did notice the same. It will bypass the validation and adds the record to the repository. Even if you follow the option 1 given by Klaus David.

I would suggest the following way. Its a work around.

1. Use CatalogData's AddRecord Method.

2. Get the record Id for the record you added.

3. Use the CatalogData's CreateValidateRecordsCommand method to get the ValidateRecordsCommand Object.

4. Use the ValidateRecordsCommand object to set the values using the following methods.

SetTable,SetRecordIDs.

5. Use ValidateRecordsCommand's GetValidationFailures method to get the ValidationFailures object.

6. Use ValidationFailures GetRecordIDs methd to get the validation failed record ids.

7. Match the initial added record id with the record id's.

8. Delete the records using the CatalogData's DeleteRecords method by passing the record ids.

Thanks and Regards

Subbu

sridhar_k2
Active Contributor
0 Kudos

Hi All,

I have 3 chars width column in my table and user is sending 10 chars to insert. It is trancating to 3 chars and inserting it to database.

If I use the methodology u mentioned above,first it will add it to the database and check for failures.

Can u explain me clearly how it will validate in the above case.

former_member192347
Participant
0 Kudos

Need to set Validation Id on object ValidateRecordsCommand using the SetValidationIDs method. How to get the value for validation Id?

Thanks,

Abhay

Former Member
0 Kudos

Hi Abhay,

Use the getRecordsByValue to get the record id of the validation (this is what is meant by Validation Id).

Use "Validations" as the table name, "Name" as the field name and the name of the validation as the string to search for.

Hope this helps,

Richard

Former Member
0 Kudos

Richard/All, Am I imagining things or has the name of that table changed to "ValidationsYYY" in SP4?

Former Member
0 Kudos

Shiva,

Try to execute the validation using the API.

Regards,

Rajani