1. Jay Hastings
  2. PowerBuilder
  3. Friday, 24 February 2023 16:15 PM UTC

This is my first time trying to use Regular Expression in the datawindows Validation Expression and Message.  I got help with the Expression , thank you.

In my compiled app if I break the rule, I get the pop up with the message.  When I click OK, The message pops up again, moved a little from where it was the first time.  So I always get the pop up twice after tabbing out of the field.  If I clear the field, and have Empty String is NULL, I get the pop up.  Twice.

Am I missing something or is there a better way to handle the message?

Thanks in advance.


Jay

Jay Hastings Accepted Answer Pending Moderation
  1. Thursday, 2 March 2023 00:19 AM UTC
  2. PowerBuilder
  3. # 1

Thank you all.  I took your advice and coded itemchanged and itemerror instead.  Much more straight forward.

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Saturday, 25 February 2023 18:57 PM UTC
  2. PowerBuilder
  3. # 2

Hi,

Check what code you have (if any), in the itemError event. Maybe it's setting the focus to another column or similar.

There's several possible return values that might be useful in the ItemError event,

Also check what's in the Get- LoseFocus events of the control. When the Validation error message pops up, losfocus will be triggered and when you close the messagebox, getfocus will be triggered.

(Not fo forget about itemFocusChanging event).

regards.

Comment
  1. Miguel Leeuwe
  2. Saturday, 25 February 2023 19:19 PM UTC
BTW, I also agree with the others that it's better to use the ItemChanged event for validations.
  1. Helpful 1
There are no comments made yet.
Vladimir K. Accepted Answer Pending Moderation
  1. Friday, 24 February 2023 19:31 PM UTC
  2. PowerBuilder
  3. # 3

Hi Jay.

Hi All.

We are using expressions extensively since 1994 and so far, never have any issues with it.
Example:

column description string(40)
Validation Expression: len(trim(gettext())) > 0 and len(gettext()) = len(leftTrim(gettext())) and pos(gettext(), "'") = 0 and pos( gettext(), '"') = 0
Validation Message: 'Description cannot be blank, contain double or single quotes or have leading spaces.'

 

I can suspect following:

Something wrong with validating expression

Beside datawindow column validation, there is a validating script on datawindow in the itemchanged event or else.

Jay, can you export window and datawindow and attach it here, i am kind of curios.

Thank you

Vladimir

Comment
  1. John Strano
  2. Thursday, 30 March 2023 13:29 PM UTC
Very useful examples. The documentation could be enhanced to use this level of detail. Thank you.
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 24 February 2023 18:51 PM UTC
  2. PowerBuilder
  3. # 4

I agree with Matt. I avoid the use of the DW validation expression/message for similar reasons.

Comment
There are no comments made yet.
Matt Balent Accepted Answer Pending Moderation
  1. Friday, 24 February 2023 17:03 PM UTC
  2. PowerBuilder
  3. # 5

I've always found the DW validation expressions to be problematic and never quite do what I want them to do.  Case in point when the user blanks out a problematic entry they often still get the error message (cause the field is null or somesuch thing).

I usually either validate in Itemchanged event or post a 'ue_postitemchanged' type event to validate things and then return the user to the column if they enter in bad data.

My $.07 worth ($.02 adjusted for inflation)...

Matt

Comment
  1. Armeen Mazda @Appeon
  2. Friday, 24 February 2023 17:47 PM UTC
Here in California we are running at $.09! Hahahaha
  1. Helpful
  1. Sivaprakash BKR
  2. Sunday, 26 February 2023 13:54 PM UTC
Here in India, need to multiply that by 80 (approximately).
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.