Page 1 of 1

How can I make a line break within a string in code

Posted: Thu Feb 18, 2010 9:11 pm
by Joerg
Hi again,

I have a line of code where I have long SQL string and I'd like to make a line break within the string because of the better legibility of the code.

The code looks like this one:

Code: Select all

put "SELECT thisColumn, thatColumn,  THERE SHOULD BE THE LINE BREAK
"FROM tblTable" into tList
I have tried a backslash but it did not work.

Has anyone an idea?

Thanks

Jörg

Re: How can I make a line break within a string in code

Posted: Thu Feb 18, 2010 9:23 pm
by bn
Joerg,

Code: Select all

put "SELECT thisColumn,thatColumn," & \ -- here is the linebreak, it is a backslash
          "FROM tblTable" into tList
be careful in quoted strings, you have to go about it like in the example, in unquoted revtalk you can say

Code: Select all

 put tSomeThing into \
                 anotherThing
after the backslash you make your return
regards
Bernd

Re: How can I make a line break within a string in code

Posted: Thu Feb 18, 2010 9:37 pm
by Joerg
Hi Bernd,

thank you very much for the quick and competent answer!!!! You made my evening!!!

best regards

Jörg

Re: How can I make a line break within a string in code

Posted: Thu Sep 26, 2013 9:23 pm
by jalz
Hi Guys,
With some research, looks like you use the &\ to break lines down. I seem to have broken it down

Code: Select all

put "CREATE TEMPORARY TABLE tmp AS SELECT customerID, title, first_name, last_name, position, telephone, mobile, email FROM customer_contact WHERE customerID=" & var_customerID & ";" &\
   "UPDATE tmp SET customerID=" & new_customer_id & ";" &\
   "INSERT INTO customer_contact(customerID, title, first_name, last_name, position, telephone, mobile, email) SELECT * FROM tmp;" &\
   "DROP TABLE tmp;" into tTheSQLQuery1
   
   revExecuteSQL gConnID, tTheSQLQuery1