Changing a Validate Statement in CHUI

garym@camgar.ca

New Member
In CHUI Progress, I am able to programmatically change the HELP of a form.

As an example:
if obuf.order-type = "C" then
obuf.cust-po#:HELP = "Enter original invoice # or blank".
else

obuf.cust-po#:HELP = "Enter customer po #".

How can I change the validate routine in a similar manner?

As an example:
- If = "C" I want to have one validate statement and if not "C"
then naother but I want to be in the same frame

Many thanks in advance.

Gary Mittleman
garym@camgar.ca
 
I'm probably not understanding the question or missing something, but why wouldn't this work?

VALIDATE( (some-field = "C" and <my condition>) or (some-field <> "C" and <my other conditions>), "Not good message")

-or if some-field being updated/enabled in same frame-

VALIDATE( (input some-field = "C" and <my condition>) or (input some-field <> "C" and <my other conditions>), "Not good message")

-or if some-field being updated/enabled in same frame-

VALIDATE( (input frame blah some-field = "C" and <my condition>) or (input frame blah some-field <> "C" and <my other conditions>), "Not good message")

or you can use :SCREEN-VALUE if you so desire...

?
 
You could use VALIDATE-EXPRESSION but I believe that only works on buffer fields.

Personally, I dislike validation expressions (especially ones derived from the schema) and I would generally use a separate validation statement after the update, eg:

UPDATE obuf.cust-po#.
IF order-type = "C" AND obuf.cust-po# = "WHATEVER"
THEN MESSAGE "something bad".
ELSE MESSAGE "something even worse".

Of course after the MESSAGE you'd need to NEXT or RETURN or something as well to reprompt for input.
 
In the FWIW category, I generally agree with Greg... database schema validation is totally worthless and can cause all sorts of problems. Validation expressions are fine for quick and dirty, and Greg's example is another way to handle it, but personally I prefer ENABLE/WAIT-FOR and trigger-based validation for both control and flexibility.
 
Nah, Greg... you were just trying to remember the 'good ole days' of character based 4GL. ;-)

Unfortunately, some of us have to have feet in the multiple worlds of character, gui, web-based et al.
 
Back
Top