Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Query calculations

Posted on by 338

Can I calculate a "new column" with a value from another column that  has been feched with a query object?

I have a Currency factor that I have to calculate as 1/Currency Factor and show this value instead of Currency Factor, is there any way to achive this in a Query Object?

TIA! 

  • Suggested answer
    Vaishnavi J Profile Picture
    Vaishnavi J 3,056 on at
    RE: Query calculations

    Hi

    Yes you can create a query object with a field. .

    and then go to page where you want to show the query object value.

    in trigger onaftergetrecord of the page right the below logic

    trigger OnAfterGetRecord

     var

           Query_Customer: Query BLL_QUERY_CUSTOMER;

    begin

          Clear(Query_Customer);

           if Query_Customer.Open() then

               if Query_Customer.Read() then

                   CustomerCount := Query_Customer.CountUnique; // assign your field value  Calculatedfieldvalue :=1/ Query_Customer.Amount;

           Query_Customer.Close();

    end;

    If my answer was helpful to you, please verify it so that other users know it worked. Thank you very much.

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

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans