web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Can we add display field into tmptable using updaterecordset?

(1) ShareShare
ReportReport
Posted on by 226
Hi everyone,
I have a requirement regarding the customization of Inventory Aging Report. I have to add /brand id/ and /brand name/ from Ecoresproduct. I have successfully added the brand field in Tmp table through /PostEventHandler/ using the Update Record set. When i add brand name field it shows me numeric values instead of name because it is stored in number in SQL. 
I have added relation with brand table to get brand name  tmp.update() and i have used select statement to get brandname() method but every time i change query , on report runtime is shows me error /Something went wrong in data preparation while generating the report/.
I have used following code ;
 [PostHandlerFor(classStr(InventAgingDP), methodStr(InventAgingDP, processReport))]    public static void InventAgingDP_Post_processReport(XppPrePostArgs args)    {        InventAgingTmp inventAgingtmp;        EcoResProduct  ecoResproduct;        Brand brand;               update_recordset inventAgingtmp        setting                  BrandId = ecoResproduct.BrandId                 join ecoResproduct                 where ecoResproduct.DisplayProductNumber == inventAgingtmp.ItemId;       // update_recordset inventAgingtmp       //setting       //     BrandName  = brand.BrandName       //     BrandId = ecoResproduct.BrandId       //     join ecoResproduct where ecoResproduct.DisplayProductNumber == inventAgingtmp.ItemId       //     join brand         where ecoResproduct.BrandId              ==  brand.BrandId;    }
 
I have the same question (0)
  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at
    This is your code:
    [PostHandlerFor(classStr(InventAgingDP), methodStr(InventAgingDP, processReport))]
    public static void InventAgingDP_Post_processReport(XppPrePostArgs args)
    {
        InventAgingTmp inventAgingTmp;
        EcoResProduct  ecoResProduct;
    
        update_recordset inventAgingTmp
            setting BrandId = ecoResproduct.BrandId
            join ecoResproduct
                where ecoResProduct.DisplayProductNumber == inventAgingtmp.ItemId;
    }
    There are no BrandId and BrandName fields in EcoResProduct table, as far as I know. Is it a customization? If so, you'll need to describe the customization to us. So far, all you said that the name a number, but we need much more details. For example, tell us what EDT it's using. I'm surprised that there is any BrandName field at all; in a normalized database, it should be in a "brands" table identifying by the ID.

    Your link of DisplayProductNumber and ItemId isn't correct. Item ID identifies a record in InventTable, not in EcoResProduct. Join InventTable with EcoResProduct via InventTable.Product and EcoResProduct.RecId.

    Also, please never use PostHandlerFor - CoC is a much better alternative.
     
  • JJDunaid Profile Picture
    226 on at
    Dear Martin,
    Yes its a customized setup for brand name in EcorstProduct table using EDT  "BrandRefRecId".
    It is rec id from brand table. Brand table is used in a setup form (View details).

    In Ecoresproduct table the field  brand name is coming from display method. My question is that, can we add display method in update_record_set ? if not then how can i achieve this?
    I have changed the relation and switched my code to COC from Post evenhandler.


     
  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at
    According to the EDT, the field is a foreign key - it contains RecId of a record in some other table. The table extension should contain a relation where you can see details (if the developer did the job correctly). To get fields from the other table, simply join EcoResProduct with it.
  • Suggested answer
    Rachit Profile Picture
    4,015 User Group Leader on at
    Hi JJDunaid,
    You need to add your table which contains brand name in the join statement as suggested by Martin. There are many standard code samples which you can refer to in AOT. Do a metadata search and you will find plenty of such code samples. 
  • JJDunaid Profile Picture
    226 on at
    I have added the third table as brand but it is generating an error message while run time.
    I have added the following code 
     update_recordset inventAgingtmp
            setting
                     BrandName   = brand.BrandName
                     join ecoResproduct
                 where ecoResproduct.DisplayProductNumber  == inventAgingtmp.ItemId
                join brand
                where ecoResproduct.BrandId               == brand.BrandId;
     
     
  • Suggested answer
    Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at
    Hi,
     
    Try to run your code on Runnable class and see if it's working or not, also for the join with Brand table you mentioned that you added the relation based on recId "BrandRefRecId"?
    but on the code, you used brand Id?
     
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • Verified answer
    JJDunaid Profile Picture
    226 on at
    Hi everyone,
    I got my solution. I was doing everything right, the code mentioned in my question is also correct but the issue was in the field type. Somehow the system was unable to store the "Brand Name" into the Temp table brand field.
    I just simply changed the field EDT to "Notes" which automatically turned fields string size to "memo", on again build and sync my report is working completely fine.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 503 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 434 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans