web
You’re offline. This is a read only version of the page.
close
Skip to main content
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 328
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)
  • Martin Dráb Profile Picture
    236,184 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
    8,949 Super User 2025 Season 2 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
    328 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
    2,174 Super User 2025 Season 2 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
    236,184 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
    328 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
    1,331 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

Responsible AI policies

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

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,339

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 600 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans