Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Tab as delimiter

Posted on by 1,289
Hi,
 
I am generating a TextStreamIO file and saving it as a CSV file attachment. I am planning to use tab as delimiter. I cannot use comma as a delimiter as one of my table field values has commas in its data. I am inserting all table fields value in a container.
But the code I am writing is not populating the data properly. All the table fields info is getting populated in the first column of CSV file rather than each table field info getting displayed in each column.
 
public class xxxxxxxService
{
    xxxxxxxContract    contract;
    CustTrans                               currentTrans;    
    container                               custTrans;
    TextStreamIo                            io;    
    System.IO.Stream                        stream; 
}
 
 
private void initIO()
    {
        io                  = TextStreamIo::constructForWrite(65001);
        statementAsOfDate    = contract.parmToDate();
         
        io.outFieldDelimiter(///);  
    }
 
protected void populateStreamline()
    {
        CustTable           custTable                   = CustTable::find(currentTrans.AccountNum);

        custTrans = [                       
                        custTable.PaymTermId,                                                       //Payment terms            
                        currentTrans.TransDate,                                                     //invoice date
                        currentTrans.Invoice,                                                       //Invoice #
                        currentTrans.Txt,                                             //Description
                    ];                     
        recordCount++ ;
        io.writeExp(custTrans);
    
}
 
 
 
 
 
 
 
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,056 Most Valuable Professional on at
    Tab as delimiter
    Also note that it won't CSV (comma-separated values) anymore and that CSV does support values containing comma, which nullifies your reason for a different separator. It's done by putting quotation marks around the value.
  • Suggested answer
    Layan Jwei Profile Picture
    Layan Jwei 7,339 Super User 2024 Season 2 on at
    Tab as delimiter
    Hi,
     
    I think this is what represents tab:
    outFieldDelimiter("\t")
    So replace your delimiter with this and try it.
     
    For more details, please check this link
     
    Thanks,
    Layan Jweihan 
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,219 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans