1. John Vanleeuwe
  2. PowerBuilder
  3. Friday, 24 November 2017

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
0
Votes
Undo

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.
  1. Friday, 24 November 2017
  2. PowerBuilder
  3. # 1
Marco Meoni Accepted Answer Pending Moderation
0
Votes
Undo

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.
  1. Friday, 24 November 2017
  2. PowerBuilder
  3. # 2
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.