1. Michał Misijuk
  2. PowerBuilder
  3. Thursday, 17 September 2020 11:37 AM UTC

Hello,

I have column "period", i set an editmask like ### to prevent enter a non-digits characters.
When I clear this column (i expected null value in table) - there is always zero.

What I want to achieve: column with numbers only and null - when null then updates and sets null, when >= 0 then specific number.

I even try to use setnull on variable and then sets in datawindow (datawindow.setitem) but still - 0? Am I missing something?

Accepted Answer
Olan Knight Accepted Answer Pending Moderation
  1. Thursday, 17 September 2020 13:24 PM UTC
  2. PowerBuilder
  3. # Permalink

You will need a display column of STRING, with the LENGTH attribute set and the EditMask applied.
That's how to get a NULL with an empty field, assuming you have the NULLWHEN EMPTY property set.

In the ItemChanged event, convert the string to either a NULL or an INTEGER and set it into the actual "period" column.


Later -

Olan

Comment
  1. Michał Misijuk
  2. Monday, 5 October 2020 16:59 PM UTC
I have figured out by myself what you have written, but still - correct answer :) thanks!
  1. Helpful
  1. Michał Misijuk
  2. Monday, 5 October 2020 16:59 PM UTC
I have figured out by myself what you have written, but still - correct answer :) thanks!
  1. Helpful
  1. Olan Knight
  2. Monday, 5 October 2020 20:22 PM UTC
:)
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 17 September 2020 15:03 PM UTC
  2. PowerBuilder
  3. # 1

Hi Olan;

   Personally, I think that the issue is because the EditMask option does not have an "Empty is Null" setting whereas the regular "Edit" style does. This would be really a good enhancement request IMHO. I never understood why PowerSoft / Sybase never implemented this.

   As a workaround though. you could code either the DC's "EditChanged" or "ItemChanged" event to set the column to NULL if the numeric value was empty or even maybe zero.

Regards ... Chris

Comment
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.