Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

form display method repeating grid field

(0) ShareShare
ReportReport
Posted on by 5

I am having an issue with the form initially not showing the notes. On the form there is a notes field in the grid that is pulled from the movement journal posted. When I go into Inventory Management>Inquiries>Transactions>Transactions and scroll to the part/transaction where its suppose to show it does not unless I click on it.  But then it repeats in the other notes above or below when I scroll over it. 

First load of the form/grid:

7455.SS1.png

Once I click 

6318.SS2.png

Code on the datamethod:

 display Description getSMCNotes()
{

    InventTransOrigin  _inventTransOrigin;
    InventJournalTrans _inventJournalTrans;
    str SMCNotes;


            select SMC_InvJournalNotes from _inventJournalTrans 
                   join _inventTransOrigin
                        where _inventTransOrigin.InventTransId == _inventJournalTrans.InventTransId
                        && _inventTransOrigin.RecId == InventTrans.InventTransOrigin;

        return _inventJournalTrans.SMC_InvJournalNotes;
  
   

}

pastedimage1603892964862v5.png

pastedimage1603894245086v1.png

  • Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,091 on at
    RE: form display method repeating grid field

    Hi kmundt,

    If you implement this method on InventTransOrigin you can just filter data from InventJournalTrans without additional joins

    Form data source version

    display Description getSMCNotes(InventTransOrigin _inventTransOrigin)
    {
        InventJournalTrans _inventJournalTrans;
        ;
    
        select SMC_InvJournalNotes from _inventJournalTrans 
            where _inventJournalTrans.InventTransId == _inventTransOrigin.InventTransId;
    
        return _inventJournalTrans.SMC_InvJournalNotes;
      
       
    
    }

    Table version

    display Description getSMCNotes()
    {
        InventJournalTrans _inventJournalTrans;
        ;
    
        select SMC_InvJournalNotes from _inventJournalTrans 
            where _inventJournalTrans.InventTransId == this.InventTransId;
    
        return _inventJournalTrans.SMC_InvJournalNotes;
      
       
    
    }

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: form display method repeating grid field

    Hi kmundt,

    you still don't have the parameter in your method, which is needed as Sergei suggested.

    But even better is to put the method in a table so that you can reuse it. And then you don't need the parameter.

    Using firstonly keyword and exists join will also make your query lighter, improving performance. But moving it to InventTransOrigin data source could allow you to have one less table in the select statement, again making it faster.

  • kmundt Profile Picture
    kmundt 5 on at
    RE: form display method repeating grid field

    Well I am in the inventTrans datasource. How would it simplify any further?

     display Description getSMCNotes()
    {
    
        InventTransOrigin  _inventTransOrigin;
        InventJournalTrans _inventJournalTrans;
     
                select SMC_InvJournalNotes from _inventJournalTrans
                       join _inventTransOrigin
                            where _inventTransOrigin.InventTransId == _inventJournalTrans.InventTransId
                            && _inventTransOrigin.RecId == InventTrans.InventTransOrigin;
    
               //SMCNotes = _inventJournalTrans.SMC_InvJournalNotes;
            return _inventJournalTrans.SMC_InvJournalNotes;
    
    
    }

  • Suggested answer
    Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,091 on at
    RE: form display method repeating grid field

    Hi kmundt,

    Display method on data source should have buffer parameter. But it's better to create methods on table level (if possible) and use caching (https://docs.microsoft.com/en-us/dynamicsax-2012/developer/caching-display-methods )

    display Description getSMCNotes(InventTrans _inventTrans)
    {
    
        InventTransOrigin  _inventTransOrigin;
        InventJournalTrans _inventJournalTrans;
        str SMCNotes;
    
    
                select SMC_InvJournalNotes from _inventJournalTrans 
                       join _inventTransOrigin
                            where _inventTransOrigin.InventTransId == _inventJournalTrans.InventTransId
                            && _inventTransOrigin.RecId == _inventTrans.InventTransOrigin;
    
            return _inventJournalTrans.SMC_InvJournalNotes;
      
       
    
    }

    By the way you have InventTransOrigin data source already in the form, so you can move your method to InventTransOrigin and simplify select statement.

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: form display method repeating grid field

    Ah, sorry, that's not possible. The only form name that I saw in your screenshot was InventJournalTrans. But that's not the form that you are working with.. instead you are working with InventTrans form.

    What if you add this method directly in InventTrans table? Or is there some reason why you want it in the form?

    display Description getSMCNotes()
    {
    
        InventTransOrigin  inventTransOrigin;
        InventJournalTrans inventJournalTrans;
    
    
        select firstonly SMC_InvJournalNotes from inventJournalTrans 
            exists join inventTransOrigin
            where inventTransOrigin.InventTransId == inventJournalTrans.InventTransId
            && inventTransOrigin.RecId == this.InventTransOrigin;
    
        return inventJournalTrans.SMC_InvJournalNotes;
      
       
    
    }

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: form display method repeating grid field

    Can't you just add SMC_InvJournalNotes field from InventJournalTrans to your grid, and not even need any display method? Or do you want to fetch it from some other record than the active selected record?

  • kmundt Profile Picture
    kmundt 5 on at
    RE: form display method repeating grid field

    Yes, the last screenshot shows it in the datasource.

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: form display method repeating grid field

    The display method must be implemented either in the underlying table, or the form data source that you use in your grid. Is it?

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,430 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans