The SUM function with SelectNumber API returns always a 0

Posted by Rollbase User on 11-Feb-2013 14:11

It looks like that I can not use the SUM with the selectNumber API within Excel reports (not document templates attached to a record, this works fine). This function always return 0, also when using a SUM around an amount field without a WHERE clause. WIth the EVAL block tester and without the SUM function, it works as expected. Is that true?

All Replies

Posted by Admin on 11-Feb-2013 16:32

Please try "Test Query" debug window and let me know what you'll find.

Posted by Admin on 12-Feb-2013 15:14

Hi Pavel,

The "Test Query" debug windows shows the correct results. The same as the EVAL tester. When using the same statement in the Excel report, it returns 0. The only difference is that I need to attach a test record when using the debug windows. Any idea?

Posted by Admin on 12-Feb-2013 15:42

How do you select record in Excel report?

Posted by Admin on 12-Feb-2013 16:22

I have put the EVAL[] block in a cell, without selecting a specific record. The SUM with and without a WHERE clause returns always a 0. Im using the document template report, not the document template from the templates section.

Posted by Admin on 12-Feb-2013 16:46

Are you using LOOP to iterate through the records?

Posted by Admin on 12-Feb-2013 18:32

Try



#EVAL[ rbv_api.selectNumber("SELECT SUM(1) FROM USER") ]



in your XLS.

Posted by Admin on 13-Feb-2013 15:00

HI Pavel,

Your statement does give results back. So the SelectNumber together with the SUM works. What i have done is:



#EVAL[rbv_api.selectNumber("SELECT SUM(gross_amount) FROM line_item")]



The Gross_amount column is an expression field, Is that the culprit? I dont know which column number gross_amount is...Couldn't we use the expression fields integration names to SUM?

Posted by Admin on 13-Feb-2013 15:41

I asked you to use "Test Query" window first. Please provide all output from "Parsed Query" and "Query Results" sections.

Posted by Admin on 13-Feb-2013 16:50

Hi Pavel,

Below you can find the outputs. Now, I get values, but they are not the same (compared to the debug window)











In Excel:





After parsing:

Posted by Admin on 13-Feb-2013 17:32

It seems like your queries are parsed correctly and result is not 0 (as you stated originally).



However result in template is different from result in Test Query window. I have no explanation to this. Please look closer. What corner symbol in A1 cell means?



I suggest you start with more transparent text -based template such as TXT or HTML.

Posted by Admin on 14-Feb-2013 01:39

Hi Pavel,

The green triangle that can appear in or next to a cell provides information about the content of the cell. Excel is converting the numberic value to a text (cell).



I have put the same spreadsheet into the document template reports section, and from there i get the correct results:







Why do i get different results? I want to use Excel and want to generate the report without selecting a specific record. Is that possible?

Posted by Admin on 14-Feb-2013 11:04

Please send me your XLS template and clearly indicate steps to get inconsistent results with it.

Posted by Admin on 30-Jul-2013 04:34

Hi,

I have still the same issue. Also on the hosted environment. Please try the following steps to reproduce it:



1 - Create a new object

2 - Create one amount field

3 - Create some records

4 - Create a HTML template as follows (the same issue also appears with Excel):







TEST











#EVAL[rbv_api.selectNumber("SELECT SUM(amountfield) FROM test")]














Any idea?







Posted by Admin on 14-Sep-2013 09:44

From Progress|Rollbase:

defect PSC00111123 has been fixed internally and is scheduled to be part of Rollbase 2.0.0.0.

This thread is closed