1. Berka Frenfert
  2. PowerBuilder
  3. Wednesday, 29 May 2019 08:35 AM

I need to set this edit mask 19~05-#### to a datawindow string column through script.


In design mode i can set the same edit mask 19~05-#### and it works fine but when i try to set it in power script then this edit mask 19~05-#### crashes my app.

This is how i check the mask in code:

String theMask

theMask = dw_1.Describe("Document_Number.EditMask.Mask")
dw_1.Object.Document_Number.EditMask.Mask = theMask

Describe function in above line returns correct edit mask i used in design mode of DataWindow but modifying same edit mask generates run-time error.

Please note that there is ~ in the edit mask. That i used to make 0 no meaning other than just a zero. That works and in edit field a space is not shown instead of 0.

Is there someone who has knowledge and help me to fix that problem?

Accepted Answer
René Ullrich Accepted Answer Pending Moderation
  1. Wednesday, 29 May 2019 10:36 AM
  2. PowerBuilder
  3. # Permalink

Hi Berka,

you have to double the ~ if you want to set it in the EditMask.


theMask = lds.Describe("Document_Number.EditMask.Mask")
ll_pos = Pos (theMask, "~~")
IF ll_pos > 0 THEN theMask = Replace (theMask, ll_pos, 1, "~~~~")
lds.Object.Document_Number.EditMask.Mask = theMask





Very Nice !!! it worked with ~~~~
  1. Berka Frenfert
  2. Wednesday, 29 May 2019 10:57 AM
René, I was trying with two ~~ signs before you gave idea to use four ~~~~ but really, i am still thinking why four worked.
  1. Berka Frenfert
  2. Wednesday, 29 May 2019 11:47 AM
~ is a escape character, so you have to double it if you want to set it for the EditMask.

But to get two ~ in a string variable you have to write four ~ (two for each ~).

So the literal "~~~~" results in ~~ in the string that the Datawindow makes to ~ for you editmask expression.


  1. René Ullrich
  2. Wednesday, 29 May 2019 11:53 AM
There are no comments made yet.

There are replies in this question but you are not allowed to view the replies from 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. Learn More