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 :
Microsoft Dynamics AX (Archived)

Issue facing while converting buffer to a container

(0) ShareShare
ReportReport
Posted on by

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    Not too sure what your problem is, the container has other containers within. It has to know what kind of table was it, the mapping of the fields, and then the values contained in the fields. It is multiple levels deep.

    You would normally not access the container values directly, since it is far away from human readable format. You would have to convert it back with con2buf before you could actually use it. The purpose of this function is to be able to pack an object with their record states too, which you could easily do as a container (as long as you do not change the table structure).

  • Community Member Profile Picture
    on at

    Thanks Vilmos,

    Basically i want to convert a buffer to a string so there is way to do that?, as for these I First convert buffer to a container then container to a string but the final string is not what I want.

    So can you tell me easier way to do that?

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    Explain the business scenario to understand better what you want, since a buffer hardly can be represented as a string.

    There are a lot of special data types for the fields in AX, which you would have a hard time to convert it into a string. Or if you do, you have to apply special formatting i.e. for dates, or whether a GUID field would be stored with or without the parenthesis, for an enum would it be it's enumeration value or the element name, or how would you show a packed container value as a string - you simply do not.

    You would be facing a lot of challenges, you would have to implement the "conversion" yourself.

  • Suggested answer
    Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    That's the correct behavior; the only problem is in your incorrect expectation about how the container will look like. If you want to a container with one value for each field, implement it by yourself. Like this:

    SysDictTable dictTable = new SysDictTable(buffer.TableId);
    container    c;
    FieldId      fieldId = dictTable.fieldNext(0);
    
    
    while (fieldId)
    {
        c += buffer.(fieldId);
        fieldId = dictTable.fieldNext(fieldId );
    }
  • Community Member Profile Picture
    on at

    I want to take a hash of the current buffer and store it to the database, for hashing I am using DimensionAttributeSetStorage::getHash() class method (argument of string type is required).

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans