Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

How to write code in separate line but continued ?

(1) ShareShare
ReportReport
Posted on by 312
Hi guys,
 
When writing code in X++ often I want to split my statement into different (separate) line. for example with this code :
 
io.write(/DATE,ACCOUNT_TYPE,ACCOUNT_CODE,HQ_OR_CLUB,DIVISION,BUSINESS_UNIT,CLASSIFICATION,PROJECT,EMPLOYEE,COSTALLOCATION,DESCRIPTION,AMOUNT, 
                    OFFSET_ACCOUNT_TYPE,ACCOUNT_CODE_1,HQ_OR_CLUB_1,DIVISION_1,BUSINESS_UNIT_1,CLASSIFICATION_1,PROJECT_1,EMPLOYEE_1,COSTALLOCATION, 
                    REFERENCE_NO,GST,DUE_DATE,INVOICE,TERM_OF_PAYMENT,DOCUMENT_DATE,DOCUMENT_NUMBER,METHOD_OF_PAYMENT,BASE_AMT_TAX,CLM_TYPE_DESC,EXPENSECODE/);
 
How to fix since I got error : /  Unterminated string constant.  /
 
 
Thanks
  • Martin Dráb Profile Picture
    231,762 Most Valuable Professional on at
    How to write code in separate line but continued ?
    As Waed pointed out, you didn't follow my example correctly. By the way, the syntax in C# is the same.
     
    Here is the documentation: String > String Literals.
  • Suggested answer
    Waed Ayyad Profile Picture
    7,760 Super User 2025 Season 1 on at
    How to write code in separate line but continued ?
    Hi,
     
    You should use it like this:
    string text = @"My pensive SARA ! thy soft cheek reclined
    Thus on mine arm, most soothing sweet it is
    To sit beside our Cot";
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • Teevo Profile Picture
    312 on at
    How to write code in separate line but continued ?
    Hi,
     
    Thanks, Actually I never heard of using this verbatim, and cannot find X++ documentation regarding this ? 
    May I know how exactly to use it ?
     
    Definitely not like this I supposed, since it is error ->
    I tried with space, add the sign in front of each string in the next line, no luck as well. 

    Noted about the FileStream, I will try after this is solved.
    Thanks
  • Suggested answer
    Navneeth Nagrajan Profile Picture
    1,452 Super User 2025 Season 1 on at
    How to write code in separate line but continued ?
    Hi,
     
    You can use @ as suggested by Martin. Would recommend using FileStream instead of the TextStreamIO (which only perform write operations). With FileStream you have more flexibility to perform both read and write operations, if in case that's your requirement.
     
     
  • Suggested answer
    Martin Dráb Profile Picture
    231,762 Most Valuable Professional on at
    How to write code in separate line but continued ?
    You can use a verbatim string (prefixed with @). For example: @"...".

    Note that you can find these things in X++ documentation.
  • Teevo Profile Picture
    312 on at
    How to write code in separate line but continued ?
    Hi,
     
    Yes, I know this. But the intention is I don't want couple of variable join into 1. The code in mine already have (" ") , but because it is too long and hard to read, I want to move some of the statement into the next line to make easy to read. 
     
    If I remember correctly, if it is C# we can use "_" to make long statement into multi line, unless I'm wrong.
     
    Thanks.
  • Suggested answer
    Raj Borad Profile Picture
    595 on at
    How to write code in separate line but continued ?
    HI Teevo,
     
    Try to store a string in a variable and use it in your method.
    io.write(yourVariable);


     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,884 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,762 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans