pellus
5th April 2007, 09:56
LN6.1 on ms-sql.
Hello all.
I communicate with another system by reading and wrting in customised baan tables. The other system uses odbc and the real tables definition in ms-sql.

Of course, the other system manages to insert a record with some funny values which causes problems for me because they are out of range according to the domain definition. (E.g. discount percent = 3354.23 . The domain says that the value can be maximum 100.00).
So when I update the record with something it crashes due to this constraint.

We have now agreed that the other system validates values before inserting, with logic from a list I have given them. But this 'solution' to the problem is not perfect. I assume that more fields will be added to this communication interface, when me and the other guy are not around, documentation only may (will) not work . So what I want to do is to validate on the Baan side, this can be done in many ways but the preferred option is:

Using the actual domain definitions, i.e. the constraints in the domain, e.g. range, is what I validate the value against.

I don't find anything in the manual (or in this forum) that gives my an idea on how to validate to domains in this way, i.e. finding out if the value in a field is allowed.

Do you have an idea on how to do this?

Important is that it must not crash, it must be a controlled validation where I give an error message and the process continues.

pconde
5th April 2007, 15:41
Hi.

Have a look to the function db.check.row.domains(table_id, field_name). I think that this can solve you problem

Regards
Philippe

JaapJD
5th April 2007, 21:07
I don't think you can use the db.check.row.domains function, because you use ODBC i.s.o. the Baan 3GL to insert records into the tables. So, you have to simulate the checks which are performed by database driver, bshell and the standard program. And if you defined a DAL for the table, also the DAL checks should be performed at the client side.
A partly solution can be to read the table definition and domain file (d<package><module><table#> and d<package>.pd, probably in $BSE/dict/dd<packagecomb>) into your client program. From the table dd file you can see whether a field is mandatory. In the domain file you can use the datatype, legal and illegal characters and the range fields to do the validation. Especially the range field is a tough one to interpret!
Another option is to generate client source code around the dd-files.

Good luck!

PS. A better option of course is to integrate with ERPLN using the ERPLN Integration tooling (OA6.1). Then you will have your data validated automatically.

pellus
9th April 2007, 15:50
Yes, the function db.check.row.domains(table_id, field_name) is tested in my intended design, and does the job. Thanks.