Jump to content
Server Maintenance This Week. ×

ExecuteSQL Sum difference between dataviewer and calculation


This topic is 3061 days old. Please don't post here. Open a new topic instead.

Recommended Posts

LS,

I am puzzled. I have this simple sql :

Let ([
key = FORR::k_order_line_id ;
SQL = 
"Select sum(amount)  " 
& " from journal_line jl" 
& " where jl.k_order_line_id = ?" 
& " and jl.ledger =  '2053' " 


ExecuteSQL ( SQL ; "" ; "" ; key  ) 
)

Data viewer returns : 1707.5 ( 1895 - 187.50 )
Calculated field returns : 170750 <- wrong. 
Calculation is number, unstored.

When I don't have decimals the sum result of both are the same.

 

Any ideas as to why ?

 

TIA,

 

Joost

Edited by Joost Miltenburg
Link to comment
Share on other sites

SQL may be a reserved word? try changing the variable name to something other than SQL.

https://www.drupal.org/node/141051

try

Let ([
_key = FORR::k_order_line_id ;
_SQL = 
"Select sum(amount)  " 
& " from journal_line jl" 
& " where jl.k_order_line_id = ?" 
& " and jl.ledger =  '2053' " 


ExecuteSQL ( _SQL ; "" ; "" ; _key  ) 
)

Edited by Kris M
Link to comment
Share on other sites

This topic is 3061 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.