web
You’re offline. This is a read only version of the page.
close
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 395
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
I have the same question (0)
  • Suggested answer
    Raj Borad Profile Picture
    1,424 on at
    HI Teevo,
     
    Try to store a string in a variable and use it in your method.
    io.write(yourVariable);


     
     
  • Teevo Profile Picture
    395 on at
    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
    Martin Dráb Profile Picture
    237,807 Most Valuable Professional on at
    You can use a verbatim string (prefixed with @). For example: @"...".

    Note that you can find these things in X++ documentation.
  • Suggested answer
    Navneeth Nagrajan Profile Picture
    2,407 Super User 2025 Season 2 on at
    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.
     
     
  • Teevo Profile Picture
    395 on at
    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
    Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at
    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
     
  • Martin Dráb Profile Picture
    237,807 Most Valuable Professional on at
    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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans