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

find() and exist() both need to add in Add Ins:

(0) ShareShare
ReportReport
Posted on by 56

Dear All,

I have one requirement. I am creating a new table. Customer wants to add find() and exist() bothin Add Ins:

5707.table.png

Please give me more shed on this.

Thanks!

Arpan Sen

*This post is locked for comments

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

    Your requirement is unclear.

    If you are on table, you have to add the find and exist methods yourself under the Methods treenode for record manipulation.

    Adding something to the Add-ins menu is a different story, that can be done as per the link above, but what would be the purpose of a find, and exist there? If you want a code template, that could done instead in the EditorScripts class.

  • @rp@n Profile Picture
    56 on at

    Thanks Vilmos,

    I go through the above link.

    Actually customer requirement is they want to show find() and exist() both in Add Ins in Table level.

    In table level method node both methods are there but they want to use those method from Add Ins not from method node form table level.

    Is't possible? I think it's not possible as i understood.

    please confirm.

    Thanks!

    Arpan Sen

  • Vilmos Kintera Profile Picture
    46,149 on at

    We still do not understand what the functionality should do from a clickable menu item.

  • @rp@n Profile Picture
    56 on at

    Vilmos

    for example when we need to check find() in table then we generally navigate table \ method \ find()

    The same thing they want to use from Add Ins. They want find() and exist() there .

    If required they open find() or exist() from Add ins instead of Table \ method \ find() or exist().

    Is't possible?

    Thanks!

    Arpan Sen

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

    What is the difference of going to the table in the AOT, expanding the table, then the Methods node to see if two methods are there or not, compared to implementing the check in the Add-ins menu - isn't it the same amount of clicks?

    If they want to verify whether find or exist method is present on a table, why not just do it as a select statement on the ModelElement and ModelElementData tables?! I would do it that way. You could even filter it out to only care for tables that are on a specific layer, and so on.

  • Community Member Profile Picture
    on at

    "Is't possible?"

    It is possible. I see same thing

  • @rp@n Profile Picture
    56 on at

    Thanks Vilmos and Grigory.

    I asked with customer also. they told the same thing the purpose of those methods in Add Ins that those methods are available in Table level or not.

    If yes, they want to open from there.

    @ Grigory : Could you please send me the link. How to add find() and exist() in Add Ins.

    Thanks!

    Arpan Sen

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

    So this is what I would do on such request.The logic can easily be changed to also filter by name of the table, in case you still want to add it in Add-ins menu, using Grigory's link.

    static void WIK_findTableWithoutFindExist(Args _args)
    {
        SysModelElement         modelElement;
        SysModelElement         modelElementMethod;
        SysModelElementData     modelElementData;
        SysModelManifest        modelManifest;
    
        void doFind(MethodName _methodName)
        {
            int i = 0;
            
            while select modelElement
                order by Name
                where modelElement.ElementType == UtilElementType::Table
                notexists join modelElementMethod
                    where  modelElementMethod.ElementType   == UtilElementType::TableStaticMethod
                        && modelElementMethod.Name          == _methodName
                        && modelElementMethod.ParentId      == modelElement.AxId
                // --> if you want to filter it by layer, i.e. standard SYS is Foundation
                exists join modelElementData
                    where modelElementData.ModelElement     == modelElement.RecId
                exists join modelManifest
                    where  modelElementData.ModelId         == modelManifest.Model
                        && modelManifest.Name               == 'Foundation'
                // <--
            {
                info(strFmt('%1 missing %2', modelElement.Name, _methodName));
                i++;
                // Early interrupt, not to loop whole SYS layer, for example's sake
                if (i==10) 
                {
                    break;
                }
            }
        }
    
        doFind('exist');
        doFind('find');
    }
  • Community Member Profile Picture
    on at

    I am sorry but I haven't link (I saw it at the consulting company) But it is not difficult

    +-

    stackoverflow.com/.../add-a-method-dynamically-in-ax-2012-component

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Prashant Singh Profile Picture

Prashant Singh 2

#1
nmaenpaa Profile Picture

nmaenpaa 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans