To break a single statement into multiple lines

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
mhcha
Junior Coder
Posts: 23
Joined: Sat Jan 01, 2022 11:10 am

To break a single statement into multiple lines

Post by mhcha » Wed Jul 05, 2023 2:05 am

hello,

If one line of code is long, is there a way to change it to the next line and continue writing? Long code makes it less readable.

ex)
cmd.CommandText = _
"SELECT * FROM Titles JOIN Publishers " _
& "ON Publishers.PubId = Titles.PubID " _
& "WHERE Publishers.State = 'CA'"

User avatar
Grovkillen
Automation Wizard
Posts: 1024
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: To break a single statement into multiple lines

Post by Grovkillen » Wed Jul 05, 2023 6:32 am

Use the labeltovar command.
Let>ME=%Script%

Running: 15.0.24
version history

mhcha
Junior Coder
Posts: 23
Joined: Sat Jan 01, 2022 11:10 am

Re: To break a single statement into multiple lines

Post by mhcha » Wed Jul 05, 2023 7:20 am

excellent!
Now it works as i want.
Thank you Grovkillen.

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: To break a single statement into multiple lines

Post by JRL » Wed Jul 05, 2023 3:40 pm

:?:
Could one of you post an example?

mhcha
Junior Coder
Posts: 23
Joined: Sat Jan 01, 2022 11:10 am

Re: To break a single statement into multiple lines

Post by mhcha » Fri Jul 07, 2023 4:05 am

Yes I will post an example for others.

Ex)

Code: Select all

MDL>text1%CRLF%text2%CRLF%text3%CRLF%text4%CRLF%text5%CRLF%text6%CRLF%text7%CRLF%text8
In the case of the example above, you can change it to:

Code: Select all

/*
Text:
text1
text2
text3
text4
text5
text6
text7
text8
*/

LabelToVar>Text,MyText,1,0,*/
MDL>%MyText%

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts