A
agent_008_nl
Guest
> I'd planned to have small, individual pieces of code logic in individual validation procedures/methods. So one would > be 'is not empty" (for isntance), and another would be "has a valid mime type". Maybe I should work out my suggestion a bit? Your assertion could look like this: lOk = phBuffer:find-unique('where rowid(' + phBuffer:name + ') = to-rowid(' + quoter(cRowid) + ') and ' + cRule) no-error. You can test both "is not empty" and "has a valid mime type" with this code + rules like cRule = "lookup('text/html,video/animaflex etc etc',something.mimetype) > 0" cRule = "something.notemptyfield <> '' " I added the small ppt ppt of my presentation in Brussels 2013 (emea pug) to make it a bit more clear, see the last two pages. There wil be validations that you cannot do with this code. For these you need other pieces of validation logic that you can call dynamically based on what's in your rule. Your validation module can take the dataset to validate as input. It should query the dataset with rules to validate fieldlevel, recordlevel and eventualy datasetlevel (cardinalities f.e.: an order has to have at least one orderline associated). A temptable with rules could look like the one here: https://community.progress.com/community_groups/mobile/f/17/t/16432 Of course you could hard-code the creation of a couple of rule-records for the time being, and remove them if ever you / others create a brms (are you working on aetf mobile?). Mimetype could be an array column in the database / dataset if the beloved language / db would support it. (there he goes again ;-) Postgresql does: http://www.postgresql.org/docs/9.1/static/arrays.html .
Imagine a new mimetype being necessary. Wouldn't it be nice if you only had to insert it into the db to get your validation ready? And wouldn't it be nice if your validationrules could be used on a non-abl client? F.e. in the HTML5 Constraint Validation API? I use them for that. Thinking about OO implementations I leave eagerly to Tim and you. ;-) -- Kind regards, Stefan Houtzager Houtzager ICT consultancy & development www.linkedin.com/in/stefanhoutzager (Please visit the site to view this file)
Continue reading...
Continue reading...