web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Converting array to str and storing in a field

(1) ShareShare
ReportReport
Posted on by
////Hi Team,
 
I have created a custom entity for whsinventtable and created a virtual field called strfilterCode. In postload method, I want to store filtercode array field value to this virtual field. How can I convert array to str and store in this virtual field? Please help.
I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    238,745 Most Valuable Professional on at
    Do you want values separated by a delimiter?
     
    You could use something like this:
    for (int i = 1; i <= dimOf(whsInventTable.FilterCode); i++)
    {
        if (this.StrFilterCode)
        {
            this.StrFilterCode += ',';
        }
    
        this.StrFilterCode += whsInventTable.FilterCode[i];
    }
    
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    Are you saying you have a container value to be stored in a string field? If yes, then you can make use of standard con2str() and pass any delimiters if you need. 
  • Martin Dráb Profile Picture
    238,745 Most Valuable Professional on at
    FilterCode is an array field, not a container.
  • Karuna Dogra Profile Picture
    on at
    Thank you so much Martin, that works. Also, I have been trying to mark that check box does this question your answer but its just keep buffering.
     
    Can you please also guide, how I can avoid extra comma in the string field StrFilterCode in case out of 5 indexes (Filter code 1, Filter code 2, Filter code 3....) only one index has value? It is storing the value like this  Item1,,,,
     
    Please guide.
     
    Thank you
  • Verified answer
    Martin Dráb Profile Picture
    238,745 Most Valuable Professional on at
    It's trivial - you just need a condition to skip adding the separator if the filter code value is empty. For instance:
    for (int i = 1; i <= dimOf(whsInventTable.FilterCode); i++)
    {
        str filterCode = whsInventTable.FilterCode[i];
    
        if (filterCode && this.StrFilterCode)
        {
            this.StrFilterCode += ',';
        }
    
        this.StrFilterCode += filterCode;
    }
  • Karuna Dogra Profile Picture
    on at
    That worked. Thanks a lot Martin (The Genius). This thread can be closed. 
     
    regards
    Karuna

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 576 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 366

#3
Adis Profile Picture

Adis 256 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans