1. John Vanleeuwe
  2. PowerBuilder
  3. Friday, 24 November 2017 11:07 AM UTC

Hi all,

We have a few datawindowchilds on which we need to perform a modify statement to change the .text value at runtime.

How can we have single quotes and double quotes appear in the .text please ?

We tried the following, but both failed ( either line syntax error , or no error but the quote isnt shown on the tag).

 

dw_tmp.Modify("t_1.text = ' I NEED TO PRINT A SINGLE QUOTE NOW ''' ")

dw_tmp.Modify("t_1.text = 'I NEED TO PRINT A SINGLE QUOTE NOW ~''")

 

 

TIA

John

Michael Kramer Accepted Answer Pending Moderation
  1. Friday, 24 November 2017 13:09 PM UTC
  2. PowerBuilder
  3. # 1

You need replace single tilde in

dw_tmp.Modify("t_1.text = 'I NEED TO PRINT A SINGLE QUOTE NOW ~''")

with double tilde as in

dw_tmp.Modify("t_1.text = 'I NEED TO PRINT A SINGLE QUOTE NOW ~~''")

 

Reason: You need the DW engine to receive a tilde in front of a quote, so you have to tell the string processing in PowerScript that you really need to pass the tilde as a tilde - which requires a double tilde. 

HTH

Comment
There are no comments made yet.
Marco Meoni Accepted Answer Pending Moderation
  1. Friday, 24 November 2017 13:05 PM UTC
  2. PowerBuilder
  3. # 2

Hello,

replace every occurrence of ' with ~' in the Modify, and double-escape the single quote you want to print out.

dw_tmp.Modify("t_1.text = ~' I NEED TO PRINT A SINGLE QUOTE NOW ~~' ~' ")

Cheers,

Marco

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.