1. Sivaprakash BKR
  2. PowerBuilder
  3. Thursday, 10 October 2019 12:17 PM UTC

Hello,

Need to set different Edit Mask, all numeric with or without decimal, for a field in a Tabular / Grid datawindow.  Don't have a function like available for setting Format.  Is that possible to set ?

The issue is for each row, user will be selecting the unit [ Numbers, Meters ... ] and then enter Opening Stock quantity in the next field.   For the same item, there is a possibility of having more than one unit [ Meters as well as numbers ].  For meter unit, decimal value is allowed but NOT for numbers unit.   

Sometimes, users tend to enter decimal values for numbers unit also.  Instead of entering 24 they tend to enter 24.500.  Due to format setting, the value shows without decimal, rounding to the nearest integer, as 25 in this case.  And it cascade its effect to opening stock value, instead of 25 * Rate, it multiples 24.5 * Rate.  

Setting EditMask could solve this issue, I think.  Else other ways are there to avoid this wrong entry ?

EditMask setting got the following limitations.

  1. Only predefined format(s) are allowed.  It didn't respect any other formats set.
  2. No provision to call any function, like available for format setting.

Any solution to this issue really appreciated.

Sivaprakash BKR Accepted Answer Pending Moderation
  1. Friday, 11 October 2019 05:30 AM UTC
  2. PowerBuilder
  3. # 1

Thanks John for the suggestion.  I thought of it, but implementing it for the whole of Inventory module is little bit tough.   We need to introduce one more field where-ever quantity field is there [ Purchases, Pur. Returns, Sales, Sales Returns, Transfers ....]  Will be my last try, if everything else fails.

Trying to do with some coding in the itemchanged event, as suggested by Michael.   If value doesn't match with expected format, that could be rejected. 

I strongly feel that Appeon should do to improve this editmask properties.  

Happiness Always
BKR Sivaprakash

 

Comment
  1. Michael Kramer
  2. Friday, 11 October 2019 09:28 AM UTC
EditMask has a complicated past. You can't change existing behavior because it breaks existing apps. So extensions are really, really hard. Unless you add a completely new edit style type to the DataWindow engine. No small feat.
  1. Helpful
  1. Sivaprakash BKR
  2. Friday, 11 October 2019 10:48 AM UTC
I agree. Not only EditMask but for many other controls too, extensions are hard. There is a need for preventing wrong data entry too and as a PB developer, I expect it in PB too.
  1. Helpful
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Thursday, 10 October 2019 14:04 PM UTC
  2. PowerBuilder
  3. # 2

Two fields in same X/Y location but visible depending on value in another field is often a great solution. (John has my vote)

Sometimes you need to supplement visual controls with extra validation in ItemChanged. Here you can use Match  function to perform reg-ex checks on entered data if need be.

HTH /Michael

Comment
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Thursday, 10 October 2019 13:34 PM UTC
  2. PowerBuilder
  3. # 3

if you want to use editmask, you will have to do a modify on row change to change the editmask.  There is (was) an undocumented ability to use an expression with an editmask, but you can only set it via syntax editing (you can't see it in the datawindow editor).  If you think PB should allow editmask expressions, please enter it as a bug so that appeon will consider changing/supporting it.

 

for the display for rows without focus you have to use format.

use # in display format to show numbers if they are there, but not show extra zeros:  #,##0.0####

and the display format can be set as an expression if you only want to display decimal places when the value has one:

'#,##0' + if( truncate(fieldname , 0) = fieldname, '', '.0######')

 

 

 

Comment
There are no comments made yet.
John Raghanti Accepted Answer Pending Moderation
  1. Thursday, 10 October 2019 13:05 PM UTC
  2. PowerBuilder
  3. # 4

An EditMask follows the control, regardless of what row you're on. So, if you have a mixture of values, the EditMask won't work for you.

Seems to me like you could use two fields, one for meters and one for numbers. Based on the units selected, make the appropriate field visible for editing. You can set the distinct EditMask for each of those fields.

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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.