Skip to main content

Notifications

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 208
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;    }
 
  • Verified answer
    JJDunaid Profile Picture
    208 on at
    Can we add display field into tmptable using updaterecordset?
    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.
  • Suggested answer
    Waed Ayyad Profile Picture
    7,958 Super User 2025 Season 1 on at
    Can we add display field into tmptable using updaterecordset?
    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
     
  • JJDunaid Profile Picture
    208 on at
    Can we add display field into tmptable using updaterecordset?
    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
    Rachit Profile Picture
    4,015 User Group Leader on at
    Can we add display field into tmptable using updaterecordset?
    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. 
  • Martin Dráb Profile Picture
    232,068 Most Valuable Professional on at
    Can we add display field into tmptable using updaterecordset?
    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.
  • JJDunaid Profile Picture
    208 on at
    Can we add display field into tmptable using updaterecordset?
    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
    232,068 Most Valuable Professional on at
    Can we add display field into tmptable using updaterecordset?
    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.
     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

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... 293,289 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,068 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans