Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

How we can convert display methods into fields used on grid in ax2012

Posted on by 43

Dear community i would be grateful for the suggestions or answers

I have a task to convert display method code into field on grid 

below i have code task is to remove this approach and manage by alternate way how i can resolve this issue in ax2012 

[SysClientCacheDataMethodAttribute(true)]

display PurchLineShowItemName itemName()

{

    PurchLineShowItemName purchLineShowItemName;

 

    if (this.ItemId)

 

   {

        purchLineShowItemName = this.inventTable().itemName(this.inventDim());

    }

    else

    {

        purchLineShowItemName = this.Name;

    }

 

    return purchLineShowItemName;

}

  • Suggested answer
    Komi Siabi Profile Picture
    Komi Siabi 12,692 Most Valuable Professional on at
    RE: How we can convert display methods into fields used on grid in ax2012

    Okay then,

    On the itemid field of the form, override the modifiedField method and insert your logic.

  • Wajahat wasti Profile Picture
    Wajahat wasti 43 on at
    RE: How we can convert display methods into fields used on grid in ax2012

    Yes Exactly i want that .

  • Suggested answer
    Komi Siabi Profile Picture
    Komi Siabi 12,692 Most Valuable Professional on at
    RE: How we can convert display methods into fields used on grid in ax2012

    Ok, this is what I get from your explanation, you already have a field that is looking into a display method and this works fine.

    You would want to discard the display method.

    What I can think of is moving the block of code from the display method inside the modifiedfield method of the itemId field.

  • Wajahat wasti Profile Picture
    Wajahat wasti 43 on at
    RE: How we can convert display methods into fields used on grid in ax2012

    This display method is working on Purchase order lines  .i just want an alternate field  to escape from display method and use another field without display method .  Working on Ax2012

    [SysClientCacheDataMethodAttribute(true)]

    display PurchLineShowItemName itemName()

    {

        PurchLineShowItemName purchLineShowItemName;

        if (this.ItemId)

       {

            purchLineShowItemName = this.inventTable().itemName(this.inventDim());

        }

        else

        {

            purchLineShowItemName = this.Name;

        }

        return purchLineShowItemName;

    }

  • Komi Siabi Profile Picture
    Komi Siabi 12,692 Most Valuable Professional on at
    RE: How we can convert display methods into fields used on grid in ax2012

    Okay,

    1. Could you please tell me the purpose of the form ?

    Is it an enquiry page ?

    Is it a data entry page ?

    2. At what point exactly do you want some of these fields hidden/displayed ?

  • Wajahat wasti Profile Picture
    Wajahat wasti 43 on at
    RE: How we can convert display methods into fields used on grid in ax2012

    I really appreciate your effort for helping me but i don't need to set condition like that Thank you

  • Komi Siabi Profile Picture
    Komi Siabi 12,692 Most Valuable Professional on at
    RE: How we can convert display methods into fields used on grid in ax2012

    For the condition,

    Did you compliment what I suggest in your post here ?

    community.dynamics.com/.../how-to-set-condition-on-datasource-level-for-fields

  • Wajahat wasti Profile Picture
    Wajahat wasti 43 on at
    RE: How we can convert display methods into fields used on grid in ax2012

    I have view which have item id and item name there and i create relation on purchline table with view by item id it fetch record properly ...I am stuck to implement condition where if we have item id we have to show the item name else we have to fetch Name field from purchline data source as you can see in above code i shared .Only facing problem to implement condition where should i implement condition i dont know .

  • Suggested answer
    Komi Siabi Profile Picture
    Komi Siabi 12,692 Most Valuable Professional on at
    RE: How we can convert display methods into fields used on grid in ax2012

    So you are using view instead of the table and you are having challenges.

    Please tell us where the issue lies with that view.

  • Wajahat wasti Profile Picture
    Wajahat wasti 43 on at
    RE: How we can convert display methods into fields used on grid in ax2012

    Above code is working as field but i want to reduce process time because display methods consume more time to access data from db .. This can be possible by using query and view then drop view as form source on form drop field from datasource to grid but having problem while implementing above condition .

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!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans