Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

ExecuteSQL Sum difference between dataviewer and calculation

Featured Replies

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

And this is not just a field formatting issue on the layout?  IOW you get the same result when you click into the field.

  • Author

Hi Wim,
no, this is not an formatting issue.

When I export the data to excel the value is just plain wrong ( 170750 instead of 1707.5 ) 
I find this very odd.

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

  • Author

Unfortunately that did not help.

Did not solve issue, but as I need a solution now, I just created a relationship and summed the field. Result as expected.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.