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)

converting container to hash key.

(0) ShareShare
ReportReport
Posted on by

Hello,
I see that container cannot be used as an index in table.

I want to convert a container to hash value, I can use that hash value as an index of a table (It is not preferred, but it may be duplicate sometimes).

 

Is there any function converting container to an hash value (string or long number)?

 

Thanks :)

*This post is locked for comments

I have the same question (0)
  • Guy Terry Profile Picture
    28,924 Moderator on at

    Hi Eitan,

    I've no idea if it answers your question, but I notice that there's a class on the table InventDim called hashValue which, erm, calculates a hash value.

  • Community Member Profile Picture
    on at

    I got exception that constractFromContainer has invalid parameters

    (parameter: ['a', 'b', 'c', d'])

    I think that MD5 or CRC are fine.

    found: krishhdax.blogspot.co.il/.../useful-functions-to-use-in-ax2012.html

    - didn't check it yet.

    Thanks :)

  • Martin Dráb Profile Picture
    237,987 Most Valuable Professional on at

    There is infinite number of ways how to compute a hash and, of course, different implementations and different hash algorithms have different properties. So it's not easy to answer your question unless you tell us more about your requirements.

    Above all, what data types are in the container and which kind of hash do you want to get?

  • Community Member Profile Picture
    on at

    My requirement is convert the container to index, and use it in x++ select statement.

    Container is a field in db, and because it cannot be indexed, I shall convert it to some data.

    I guess i can do that by using view with calculated column, like this:

    The function of the calculated column may return something like

    substring(sys.fn_sqlvarbasetostr(HashBytes('MD5', keycontainer)), 3, 32)

    and using that view in my select statement.

    But it is better, I can use the above link and add a new column in order to set the hashkey as an index.

    I think this solve the mentioned problem.

    Thanks, anyway :)

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