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

Community site session details

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

form query and T_SQL query return different values for totalcostamountfield

(0) ShareShare
ReportReport
Posted on by 942

Hello,

I have a standard form called Posted Project Transactions(projProjectTransactionsListPage). I open it for a particular project and get 40 records. The values for TotalCostAmountCur values are like below following

Total cost amount
264.00
264.00
264.00
264.00
264.00
264.00
32.50
303.64
800.00
301.52
223.63
94.23
296.00
130.00
216.88
800.00
86.69
118.37
242.00
130.00
325.32
800.00
86.69
118.37
300.00
130.03
118.37
376.90
136.33
136.33
136.33
136.33
136.33
800.00
28.27
28.27
28.27
184.86
28.27
28.27

and their sum is 9423

The underlying query of the form before the form opens is 

SELECT FIRSTFAST FORUPDATE * FROM ProjPostTransView(ProjPostTransView_1) 
	ORDER BY ProjPostTransView.TransDate ASC 
		WHERE ((TransDate>={ts '2003-11-12 00:00:00.000'})) AND ((ProjId = N'0151328')) 
	JOIN FORUPDATE * FROM ProjTable(ProjTable_1) 
		ON ProjPostTransView.ProjId = ProjTable.ProjId 
	NOTEXISTS JOIN FORUPDATE * FROM ProjPostTransSaleView(ProjPostTransSaleView_Invoiced) 
		WHERE ProjPostTransView.TransId = ProjPostTransSaleView.TransId AND ((TransStatus = 1)) 
	NOTEXISTS JOIN FORUPDATE 'x' FROM ProjOnAccTransView(ProjOnAccTransView) 
		WHERE ProjPostTransView.TransId = ProjOnAccTransView.TransId AND ((TransactionOrigin = 22)) AND ((PSAIsOnAccount = 1)) 
	OUTER JOIN FORUPDATE * FROM ResourceView(ResourceView) 
		ON ProjPostTransView.Resource = ResourceView.RecId 
	OUTER JOIN FORUPDATE * FROM smmActivities(smmActivities) 
		ON ProjPostTransView.ActivityNumber = smmActivities.ActivityNumber AND ProjPostTransView.dataAreaId = smmActivities.dataAreaId 
	EXISTS JOIN FORUPDATE * FROM ProjTable(ProjTable_2) 
		WHERE ProjPostTransView.ProjId = ProjTable.ProjId}

Then I run the following query in T-SQL

select totalcostamountcur from PROJPOSTTRANSVIEW
 where projid = '0151328'

it returns the following values for totalcostamount field and numver of records is also 40.

TotalCostAmount

264.00
264.00
264.00
264.00
264.00
264.00
800.00
301.52
178.00
75.00
303.64
32.50
130.00
296.00
86.69
118.37
800.00
216.88
242.00
325.32
800.00
118.37
86.69
130.00
300.00
130.03
300.00
118.37
136.33
136.33
136.33
136.33
136.33
800.00
28.27
28.27
28.27
147.14
28.27
28.27

the values surprisingly are different and their sum is also different. It's 9243.52.

It seems like on the form some dynamics values are added to the field. I have studied all the code relating to the form but I don't see any indirect adding any values to the field totalcostamount. Therefore I'm at a dead end. Any suggestions where to look at are much appreciated.

Many thanks.

I have the same question (0)
  • Verified answer
    André Arnaud de Calavon Profile Picture
    299,897 Super User 2025 Season 2 on at
    RE: form query and T_SQL query return different values for totalcostamountfield

    Hi Azat,

    What exact column did you take from the form Posted project transactions?

    The column Amount in transaction currency is the actual field TotalCostAmountCur.

    The column Total cost amount is a calculated field which would take the actual item cost (including recalculations) and for hour transactions it could add indirect cost.

    This could explain the difference(s).

  • dark_knight Profile Picture
    942 on at
    RE: form query and T_SQL query return different values for totalcostamountfield

    Hi Andre. Thank you. you are right. I found this in the postload of the corresponding data entity - ProjPostTransViewEntity

    pastedimage1670997666822v2.png

    Thank you.

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
André Arnaud de Calavon Profile Picture

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

#2
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 678

#3
Martin Dráb Profile Picture

Martin Dráb 526 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans