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

display method for date against itemid

(0) ShareShare
ReportReport
Posted on by 3,090

displaymethodforretestdateitemid.pngdatasourceforonhandform.pngdatasourceforonhandmacro.pngdatasourceforonhandmacrocode.png

Dear Experts,

I want to show Restest (same logic to manufacturing date or expiry date) against Item Number, right now we have manufacturing date and expiry date against the batch number.What will be the exact code. In above image i have given all code and datasource used for it, please check the above image. thanks in advance

Best Regards,

Shabir Ahmad

  • Martin Dráb Profile Picture
    Martin Dráb 231,305 Most Valuable Professional on at
    RE: display method for date against itemid

    I'm not sure what you need from us. Yes, when you run the form where you have the method, it opens the form.

    To debug your code, you should now navigate to the place where your display method is used. If you don't stop on the breakpoint, then your method isn't called at all.

  • Shabir Ahmad Profile Picture
    Shabir Ahmad 3,090 on at
    RE: display method for date against itemid

    On-Hand-Window.pngRestestDateBreakPoint.png

    Dear Martin Dráb ,

    sorry for late reply to all, i was busy somewhere else.

    Please check, when i used breakpoint and run the method it brings me ON Hand Window.

    Thanks and Regards,

    Shabir Ahmad

  • Martin Dráb Profile Picture
    Martin Dráb 231,305 Most Valuable Professional on at
    RE: display method for date against itemid

    Please use the debugger to find out whether your method gets called at all and whether it returns (non-null) value.

    It's important to isolate the problem, because otherwise we could only guess what's going on.

  • Shabir Ahmad Profile Picture
    Shabir Ahmad 3,090 on at
    RE: display method for date against itemid

    4705.Error-in-code.png2068.Restestdateonitem-number.png

    Dear Martin Dráb,

    Thanks for your great suggestion, now syntax error is ok but  Date is not showing as shown in above image on the form and on other side code is there.

    Best Regards,

    Shabir Ahmad

  • Martin Dráb Profile Picture
    Martin Dráb 231,305 Most Valuable Professional on at
    RE: display method for date against itemid

    Use maxOf() instead of max().

  • Shabir Ahmad Profile Picture
    Shabir Ahmad 3,090 on at
    RE: display method for date against itemid

    6523.Error-in-code.png

    Deaer Pedro,

    Check the syntax error in the code, i add only the mod3Retest date(my custom field on inventbatch table) but the issue is with syntax.

    Best Regards,

    Shabir Ahmad

  • Suggested answer
    Pedro Tornich Profile Picture
    Pedro Tornich 955 on at
    RE: display method for date against itemid

    Hi Shabir,

    I posted it in one of my previous replies, but now it's formatted as code for easier view.

    display RetestDate myDisplayMethod(InventSum _inventSum)
    {
        InventBatch inventBatch;
        
        select max(RetestDate)
            from inventBatch
            where inventBatch.ItemId == _inventSum.ItemId;
            
        return inventBatch.RetestDate;
    }

    Note that I'm not aware of your custom field names and it's just a sample code to clarify my suggestion.

  • Shabir Ahmad Profile Picture
    Shabir Ahmad 3,090 on at
    RE: display method for date against itemid

    Dear André Arnaud de Calavon,

    Thanks for reply, but where Pedro shared the code, i am not able to watch it??

    Best Regards,

    Shabir Ahmad

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 292,494 Super User 2025 Season 1 on at
    RE: display method for date against itemid

    I do think the code as shared above by Pedro would help then.

  • Shabir Ahmad Profile Picture
    Shabir Ahmad 3,090 on at
    RE: display method for date against itemid

    7635.Restestdateonitem-number.png

    Dear André Arnaud de Calavon,
    Thanks for your valuable reply.for all the batch numbers in batch table we have date but on On Hand form and display method i want to show Retest Date.Yes there ae multiple records for a single item, that's why one item is shown in 2 lines or 3 lines and in front of that item number I need Retest date.(sometimes i say Manufacturing date if we show One date of the manufacturing date or Retest Date then we will be able to show any kind of data) Please check the above image as well to clear the view. If it is possible so.
    Best Regards,
    Shabir Ahmad

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans