Skip to main content

Notifications

Announcements

No record found.

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

The display method on the data source in AX 2012 cannot obtain complete data

(0) ShareShare
ReportReport
Posted on by 114

I tried adding this method to the InventSum data source table to obtain the InventBatch table, but the Display method failed to obtain the InventDimId value.

I can only get the value of itemId and not the value of InventDimId. Why?What should I do?

pastedimage1603262692223v1.png

display  ExpirationDate ExpDate(InventSum _inventSum)
{
    ItemId          d_itemId        = inventSum.ItemId;
    InventDimId     d_InventDimId   = inventSum.InventDimId;

    InventBatchId d_batch = InventDim::find(d_InventDimId).inventBatchId;
    ExpirationDate l_date = InventBatch::find(d_batch,d_itemId).expDate;

    return l_date;
}

  • Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,421 on at
    RE: The display method on the data source in AX 2012 cannot obtain complete data

    Since this is a custom form based on On hand inventory form, could you please share the query being used for the data source?

  • Danzel Zuo Profile Picture
    Danzel Zuo 114 on at
    RE: The display method on the data source in AX 2012 cannot obtain complete data

    Try your code and still cannot get the InventDimId value, you post the same code as mine,thanks again

  • Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,421 on at
    RE: The display method on the data source in AX 2012 cannot obtain complete data

    In line 4 of the, you are using the variable d_InventDimId. But you are not using the active buffer that is passed into the display method.

    Please try this code and check if you are getting the InventDimId value

    display  ExpirationDate ExpDate(InventSum _inventSum)
    {
        ItemId          d_itemId        = _inventSum.ItemId;
        InventDimId     d_InventDimId   = _inventSum.InventDimId;
    
        InventBatchId d_batch = InventDim::find(d_InventDimId).inventBatchId;
        ExpirationDate l_date = InventBatch::find(d_batch,d_itemId).expDate;
    
        return l_date;
    }

  • Danzel Zuo Profile Picture
    Danzel Zuo 114 on at
    RE: The display method on the data source in AX 2012 cannot obtain complete data

    Thank you for your reply. I wrote it in line 4 of the code

  • Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,421 on at
    RE: The display method on the data source in AX 2012 cannot obtain complete data

    You are passing the table buffer (_inventSum) to the display method and are not using it. Can you try this and check if you get any value for InventDimId?

    InventDimId     d_InventDimId   = _inventSum.InventDimId;

  • Danzel Zuo Profile Picture
    Danzel Zuo 114 on at
    RE: The display method on the data source in AX 2012 cannot obtain complete data

    Thank you for your reply,This is a Form of personalized development, similar to the summary of on-hand Inventory(Show the inventory quantity  of all Items)

    Path:Product information management/Common/Released products->Manage inventory->on-hand Inventory

  • Martin Dráb Profile Picture
    Martin Dráb 230,235 Most Valuable Professional on at
    RE: The display method on the data source in AX 2012 cannot obtain complete data

    It's not completely empty - it has ItemId and quantities. That's why I assume it's actually grouped. It explains the empty RecId as well - as with other fields, the value of RecId isn't defined if it's neither grouped by nor aggregated.

  • István Orosz Profile Picture
    István Orosz 2,137 on at
    RE: The display method on the data source in AX 2012 cannot obtain complete data

    Hi Danzel,

    InventSum record buffer is empty - you should first fix the query behind.

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,235 Most Valuable Professional on at
    RE: The display method on the data source in AX 2012 cannot obtain complete data

    The problem isn't in the code above - the problem is in what query the form uses. It seems it uses grouping and the fields that are neither grouped by not aggregated simply don't have any value fetched from the database.

    If you're interested in details, look at the form in question. If you don't understand what's going on and you need help, tell us which form it is.

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans