1. Sivaprakash BKR
  2. PowerBuilder
  3. Monday, 31 July 2023 06:33 AM UTC

Hello,

Using Powerbuilder 2022 b1900, Postgresql 15

Have a computer column in a datawindow, defined as cast(null as date) as expiry along with few database columns.   
1.  EditMask of the expiry column set to MM/yyyy
2.  Format of the expiry column set to MM/yyyy

While working from PB IDE, [ click Run icon in PB IDE], no issues.  It tabs out to the next column.
While working from the EXE, control doesn't move out of the expiry column.  

I Put a messagebox in ItemChanged Event
Messagebox('expiry', String(data))                      -> I got '01/10/2022' when run from IDE
                                                                      -> Control doesn't move out of that field, no itemchanged triggered, no messagebox

How to correct this issue?

Happiness Always
BKR Sivaprakash

 

Mark Goldsmith Accepted Answer Pending Moderation
  1. Monday, 31 July 2023 16:49 PM UTC
  2. PowerBuilder
  3. # 1

Hi Sivaprakash,

I'm thinking that the fact it works in the IDE may be more of a fluke than intended practice, maybe not...but maybe the Appeon folks can chime in with an opinion as to why. However, per the help for an EditMask with dates:

"You cannot use a partial mask, such as dd or mmm, in a date edit mask. Any mask that does not include any characters representing the year will be replaced by a mask that does." Not sure if that means only the year is required and the day and/ or month are optional?? See more here: https://docs.appeon.com/pb2019/pbug/ch21s07.html#ug38046. This kind of makes sense as MM/yyyy is not a legitimate date for a calculated field for a date type.

There is a reference to entering a 0 for the day or month and how you can change the behavior so it automatically changes it to 1 (see AutocompleteDates property) that might work for the EXE but I'm thinking not because it still expects a 0 to be entered for the day or month. Maybe Miguel's idea would get around the issue of not actually entering a value for the day.

HTH...regards,

Mark

Comment
  1. Miguel Leeuwe
  2. Monday, 31 July 2023 17:07 PM UTC
Great Mark! Never used the "AutocompleteDates " property, but then of course, I never use masks if I can avoid it :)
  1. Helpful
  1. John Fauss
  2. Monday, 31 July 2023 17:43 PM UTC
Agreed, Miguel. Edit masks are great in concept, but horrible in practice. I, too, avoid their use whenever possible. For non-standard usage (month/year only) such as this, my preference would be to provide a string (computed) column, then write a data validation function in PowerScript that would support the user's ability to specify a month/year in as many formats as needed, translating the user-supplied string value to the interpreted date if possible. If not that, then separate month (drop-down list box) and year (DDLB/DDDW/SLE) fields.
  1. Helpful
  1. Sivaprakash BKR
  2. Tuesday, 1 August 2023 05:24 AM UTC
Partial editmask (MM/yyyyy) is still working fine in PB 10.5 & PB 11.5 applications. Backend is SQL Server for those applications.
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Monday, 31 July 2023 08:51 AM UTC
  2. PowerBuilder
  3. # 2

Just to see where it goes wrong:

What if you put another Messagebox in the ItemError() event?

What if you eliminate the EditMask?

Does the field have the "required" property set?

regards.

Comment
  1. Sivaprakash BKR
  2. Monday, 31 July 2023 14:48 PM UTC
1. Messagebox in ItemError event:

From Exe: 2022-10-00

From PB IDE: 2022-10-01

2. If I remove the edit mask,

entering the full date works fine eg. 10/06/2023

3. Does the field have the "required" property set? NO



From the above details, it's clear that the date part taken is wrong while running from Exe.

Any workarounds?

  1. Helpful
  1. Miguel Leeuwe
  2. Monday, 31 July 2023 15:02 PM UTC
You could check in the ItemError event if the field is the one you work with and if it's a date with 00 for the day. Then create a valid date by setting the day to "01" and do a POST SetItem() of the value. You'd have to do a RETURN with a value of 3 so the cursor will move to whichever column it would have gone if itemerror would not have been triggered.

Obviously, this is a bug that might have been reported already or not ?

regards.
  1. Helpful
  1. Sivaprakash BKR
  2. Tuesday, 1 August 2023 10:20 AM UTC
Thanks for Miguel Leeuwe, for a workaround. We did a setitem (not POST) in the itemerror by adding the day part (with '01') and it's working with our basic testing.

Don't know why the partial editmask is working in PB 10.5, PB 11.5 and not in PB 2022.

  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.