Add Total for a Column in Data Grid Screen Based on Query
Hi Guys , I have query based on table Payments in which I search By Start Date , End Date and tenant person [ from drop down List ].
How to display sum of Payments.[Amount] column in the query screen , which off-course varies for selected person.
Omar
The data grid doesn't support calculating aggregate functions on columns automatically, but you can write a little bit of code to show the total of the payments right beneath the data grid.
Add a screen member called PaymentsTotal that is the same type as the column that you want to sum.
Drag out the screen member to be underneath the data grid. You can change the sizing settings (e.g. Horizontal Alignment) so that it aligns with the data grid how you want it.
Select the Payments collection and select Payments_Changed from the Write Code drop down.
In the generated method, write the following code:
partial void Payments_Changed(NotifyCollectionChangedEventArgs e)
// Total is the name of the property in my Payment entity that I want to sum
this.PaymentsTotal = this.Payments.Sum(p => p.Total);
When you run the screen, the PaymentsTotal property will show the total of all of the payments that are shown in the data grid.
Justin Anderson, LightSwitch Development Team
Similar Messages
-
Calculating Totals for a column in ALV Grid Display
Hi All,
I frustrated with the problem of simple calculating total for a column. I wrote the following code:
LW_CATALOG-TABNAME = P_GV_STRUCT.
LW_CATALOG-FIELDNAME = 'ZSUMMS'.
LW_CATALOG-DO_SUM = GC_X.
APPEND LW_CATALOG TO G_FIELDCAT_TAB.
CLEAR LW_CATALOG.
It is not working. Could you please suggest the solution?
It would be great help to me.
Advanced Thanks,
Phani KumarPhani,
Did u try playing around with any of these layout fields ?
no_sumchoice(1), " no choice for summing up
no_totalline(1), " no total line
no_subchoice(1), " no choice for subtotals
no_subtotals(1), " no subtotals possible
no_unit_splitting " no sep. tot.lines by inh.units
totals_before_items, " diplay totals before the items
totals_only(1), " show only totals
totals_text(60) , " text for 1st col. in total line
subtotals_text(60) , " text for 1st col. in subtotals
b. Addtionally... not a solution.. but u know...
just try the same code iwth reuse_alv_list_display and see if the total gets displayed properly ? -
the same with the following description from another question:
"How can I display a total on top of each column on a stacked column chart (using
reporting services 2008)? If I use Data Labels I can display the
values for each part of the stack on a stacked column, but I want to be display the total.
For Example: If I have stacked column on chart with a value of 10 for the 1st stack, 20 for the 2nd stack,
and 20 again for the 3rd stack - I want to display 50 (the SUM total) as the data label on top of the entire column..."
and a solution for this would create a new column named SUM(category group), this can be done with data source from SQL server, but my data is from SharePoint site list. its query seems can't be changed which means I can't add a SUM column.
what should I do with this? Can anyone give me a hand?
thank you very much.Hi sophiexu,
If we want to display a total for each column on the top of a stacked chart, we can use a matrix control to display the column total value to work around this issue.
The following thread about how to simulate chart legend is for your reference:
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/cfb4fa19-b2ba-426a-804b-b5ea83d70d62/ssrs-2008-chart-legend-missing-customitems-property
Hope this helps.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Page Total for a Column in JSF HtmlDataTable
Hi All,
I need an example to calculate page total for price column in HtmlDataTable.
Each page displays 10 rows and there are 50 rows hence 5 pages in datatable.How to calculate page total after displaying the rows on page.
Thanks in advance.Just get the desired sublist of the datalist and sum the price? You can get the starting index and the rowcount from the HtmlDataTable by its getFirst() and getRows() methods respectively and use it in List#subList(). Then iterate over the list and add the price value of every item in a loop to the total value. You can display it in the footer of the datatable. You can define a footer with <f:facet name="footer">.
-
Is there is way to hide a column in data grid column?
Is it possiblo to reorder the column like in excel . I know its not possible bcoz it <table> tag ...Select the column within the table and in the property window uncheck the visible. You can also include visible="false" in the jsp page within the column tag.
-
Revision: 3203<br />Author: [email protected]<br />Date: 2008-09-14 05:11:47 -0700 (Sun, 14 Sep 2008)<br /><br />Log Message:<br />-----------<br />Add support for inline two-way data binding (syntax is @{expr}). Also add support for two-way data binding via the <mx:Binding> tag and the new property twoWay=boolean (default is false).<br /><br />Code Reviewer: Paul<br />QA: tests for this feature need to be added to the regression test suite<br />Doc: new feature which needs to be documented<br /><br />Modified Paths:<br />--------------<br /> flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/InterfaceCompiler.java<br /> flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/analyzer/SyntaxAnalyzer.java <br /> flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/builder/AbstractBuilder.java <br /> flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/builder/AnonymousObjectGraph Builder.java<br /> flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/builder/DocumentBuilder.java <br /> flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/builder/ModelBuilder.java<br /> flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/builder/ServiceRequestBuilde r.java<br /> flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/builder/XMLBuilder.java<br /> flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/builder/XMLListBuilder.java< br /> flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/dom/BindingNode.java<br /> flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/lang/TextParser.java<br /> flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/rep/BindingExpression.java<b r /> flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/rep/MxmlDocument.java<br /> flex/sdk/trunk/modules/compiler/src/java/flex2/compiler_en.properties
EvilDave UK wrote:
Surely there's a more practical way around this without having to reboot?
Before you go to the trouble of going through all those steps, be warned that attempting to use Dreamweaver CS4 with SVN could even cause Dreamweaver to crash after updating to SVN 1.6.2. I, too, have abandoned SVN integration with Dreamweaver until the problems are sorted out. I reported this problem to Adobe a couple of weeks ago, and spent a long time working with an Adobe engineer, who was able to reproduce the problem, but not offer a solution. Hopefully, the next version of Dreamweaver will have more robust support for Subversion. -
How to add a checkbox coulmn to my Data Grid row?
Dear All ,
I have a Data Grid which have lets says 6 columns. I want to add anew column which allow the user to select it or not. Meaning if the user select the box a hack will be shown.
I want to you this coz I have a function which send an email to the user if the line (Invoice line) if selected. Now if there is more than one invoice (Line) I want the user to first select the checkbok and send press the send function button.
Later on I will create a loop in the Send function which will only send mails if the line check box is checked.
Would you please help me :)
Ps: I am using ligth switch 2008 (C#)
Thanks,
ZayedHello Zayed
I would recommend that you read through this brilliant article by
Paul van Bladel here or even look at a post on
this forum by Sven Elm. I have looked at and followed these in the past and it works perfectly.
If you found this post helpful, please mark it as helpful. If by some chance I answered the question, please mark the question as answered. That way you will help more people like me :) -
Removing Totals for Break Columns
Hi All,
If we add break on two or three columns in report, it gives totals for each group plus a report level total. Is there any way to remove any group or break's total.
For example, if we have a report on emp table and having groups on deptno and job columns, it would be giving totals like this:
JOB TOTAL: 3000
DEPTNO TOTAL: 3000
report total: 3000
How can we remove any of the above totals?
Thanks
Zahid Khan
DeptnoLooks like this is a popular request!
I have report with a break on Column 1, 2 and 3. I would like to display the Report totla but not the sub totals at each column break. Can anyone please share their experience on how to get rid of the Sub Total for a break column?
Thanks. -
Grand total (of all columns) in ALV grid
Hi Experts,
I have developed one custom ALV report in GRID format. Now Report output is displaying like below.
COL1 | COL2 | COL3 | COL4 |
TYPE1 | 10 | 44 | 05 |
TYPE2 | 01 | 20 | 35 |
TYPE3 | 05 | 10 | 20 |
=============================
sum | 16 | 74 | 50 |
But I need Grand Total for COL2 and COL3 and COL4 (i.e 16 + 74 + 50 )
This grand total line should be at the end of the internal table -- 140 .
The report output should be like below.....
COL1 | COL2 | COL3 | COL4 |
TYPE1 | 10 | 44 | 05 |
TYPE2 | 01 | 20 | 35 |
TYPE3 | 05 | 10 | 20 |
=============================
sum | 16 | 74 | 50 | ====> this sum will displayed when user select sum button on the Grid toolbar.
=============================
Grand Total 140 |
Suppose when I press sum button on the COL2. it should not change grand total. I mean Grand total should be like footer always.
Please advise
Thanks in advance.
RaghuHi
For your requirment ,you have to fill the field catalog for each field for which
you have to create the the grand total and check the option DO_SUM.
If you neeed the sub total ,in the sort table you can check the option- fs_sort-subtot = 'X'.
Just try the belo code .
It will solve your problem.
REPORT ztest.
* INTERNAL TABLE DECLARATION.
DATA:
t_sflight TYPE TABLE OF sflight,
fs_sflight TYPE sflight.
*OBJECTS FOR CONTAINER AND GRID.
DATA:
r_container1 TYPE REF TO cl_gui_custom_container,
r_grid1 TYPE REF TO cl_gui_alv_grid.
*FIELD CATALOG
DATA:
t_fcat TYPE lvc_t_fcat,
fs_fcat TYPE lvc_s_fcat.
fs_fcat-fieldname = 'SEATSMAX'.
fs_fcat-do_sum = 'X'.
APPEND fs_fcat TO t_fcat.
CLEAR fs_fcat.
fs_fcat-fieldname = 'PRICE'.
fs_fcat-do_sum = 'X'.
APPEND fs_fcat TO t_fcat.
CLEAR fs_fcat.
* SORT TABLE
DATA:
t_sort TYPE lvc_t_sort,
fs_sort TYPE lvc_s_sort.
* LAYOUT TABLE
DATA:
fs_layo TYPE lvc_s_layo.
*FS_LAYO-SGL_CLK_HD = 'X'.
fs_layo-zebra = 'X'.
fs_sort-spos ='1'.
fs_sort-fieldname = 'CARRID'.
fs_sort-down = 'X'.
fs_sort-group = '*'.
*fs_sort-subtot = 'X'.
APPEND fs_sort TO t_sort.
SELECT * FROM sflight INTO TABLE t_sflight.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN1'.
SET TITLEBAR 'TITLE1'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. "user_command_0100 INPUT
**& Module HANDLER OUTPUT
** text
MODULE header OUTPUT.
CREATE OBJECT r_container1
EXPORTING
container_name = 'CONTAINER'.
CREATE OBJECT r_grid1
EXPORTING
i_parent = r_container1.
CALL METHOD r_grid1->set_table_for_first_display
EXPORTING
is_layout = fs_layo
i_structure_name = 'SFLIGHT'
CHANGING
it_fieldcatalog = t_fcat
it_outtab = t_sflight
it_sort = t_sort.
ENDMODULE. "Header OUTPUT
Regards
Hareesh. -
CALCULATE RUNNING TOTALS FOR SUBSETS OF THE DATA IN A SECTION
How can I calculate a running total in BO XI Release 2, (WebI), where my totals only include the value of the current row and the previous 5 rows?
For Example:
In the data, behind my BO table, I have transaction dates that roll up to a dimension called Period. The "Period" represents the Year and Month of the transaction date, which is a month's worth of data at a time. Each month contains an aggregated value that is the Population of items for that month. The RunningSum function in BO works well, except that I need the running total to only include the current month along with the last 5 months, for a total of 6 months worth of data per row.
See my example below. The Period of JAN 2009 includes the Population for JAN 2009 plus the sum of the Populations from AUG 2008 through DEC 2008 for a total of 6 months worth of data. FEB 2009 includes SEP 2008 through FEB 2009. MAR 2009 includes OCT 2008 through MAR 2009...
__________Period_______Population_______6 MOS
__________200801__________54___________54
__________200802__________60__________114
__________200803__________50__________164
__________200804__________61__________225
__________200805__________65__________290
__________200806__________58__________348
__________200807__________70__________364
__________200808__________64__________368
__________200809__________59__________377
__________200810__________62__________378
__________200811__________66__________379
__________200812__________75__________396
__________200901__________62__________388
__________200902__________53__________377
__________200903__________63__________381
__________200904__________67__________386
Six months is obviously no magic number. I'd like the solution to be flexible enough to use for 3, 12, 18, or 24 month periods as well.Hi Frank,
can you consider building the rolling sums directly in your database using subselects in the select statement:
eg. select attr1, attr2,key2, (select sum(key1) from B where B.month<=A.month and B.month>=A.month-6) from A
Just create a key figure in your universe and add the subselect statement select sum(key1) from B where B.month<=A.month and B.month>=A.month-6 as select-clause.
ATTENTION: This is SQL pseudo code.
Regards,
Stratos -
How to add totals for each page in main window
hi
i have problem in scripts
how to add total in first page ending and carry it to second page , at the end of second page again adding total and so on until last page.
very urgent
regards
ratnaHi,
Check these
http://help.sap.com/saphelp_40b/helpdata/en/d1/8035c3454211d189710000e8322d00/content.htm
http://membres.lycos.fr/jolyeric/SAP/Note_de_Cours_Ben/Sapscript/SAPscript_Control_Commands.doc
try to use the command 'summing' along with one text symbol .Keep the if condtion when page changes at that time u dispay the total as ur keeping the total in text symbol it can be dispayed in the next page
or this is round about way
loop at <table>.
call write_form.
endloop.
here u declare a variable 'c' and increment it by 1 in each loop. Then u chgeck if the program has started printing second page then u can print the number of records before printing the next page.
eg :
data : c type c value '0'.
loop at <table>.
c = c + 1.
call write_form.
endloop.
in form:
check when the next page is being printed, then u can print the number
of lines 'c'.
Feel free to revert back.
--Ragu -
Sub-total and Total for a column having checkboxes in WD ABAP ALV
Hello Experts,
I have used ALV in We bdynpro ABAP to display my output. There are 2 columns that are checkboxes in Output. I want a sub-total and total for those two columns. I know tht total and sub-total functionality is available only for numeric fields .
Is there any other indirect way by which i can achieve the same ?Hi Ragini,
Please refer this thread: [alv total and subtotal|How to display graphs;.
I hope it helps.
Regards
Arjun -
Header for each column of data
I am struggling to get header for each column in attached code. I would like to see this data in excel with header at the top. Also I wonder how to know which column belongs to which plot and which axis.
Solved!
Go to Solution.
Attachments:
saving for excel.vi 130 KBI would keep this in the original thread.
-
Grand Totals for GOURL columns
We are having an issue showing Grand Totals for GOURL enabled columns
We have enabled GOURL on the amount columns, To enable hyperlink we had to convert the the number column to character. Enabling the Grand total in the Table View is thorwing error "Function Report_Sum does not support non-numeric types".
Any input on the above would be of great help.
We are using OBIEE version 10.1.3.4
Thanks
KranthiYou can try the following..
1) Keep the same name for all the amount fields in each column. (for example, first amount column field name is "Amount1" and second column field name is "Amount2").
2) Then write the code in the Calculate event of the Total field. (Use FormCalc)
Total1.rawValue = Sum(Table1.Row1[*].Amount1);
3) Similarly for Second column
Total2.rawValue = Sum(Table1.Row1[*].Amount2);
4) For the total of Amount1 and Amount2.
LoanTotal = Sum(Total1.rawValue + Total2.rawValue);
Hope this helps.
Thanks
Srini -
Suppressing totals for individual columns
In OBIEE 10.1.3.4 Answers, is there a way to suppress totaling for an individual column? I have a derived column - unit price - that I want to suppress totaling on, while retaining totals for quantity and amount. I can do it by casting the column to character, but figured there must be a better way.
Never mind... foundit!
Edited by: andrea.bender on Jul 14, 2011 6:42 AMTo suppress totaling on a specific column, go into the report and edit the formula for column and set Aggregation Rule to 'None'
Maybe you are looking for
-
Hello all I seem to stumble over a small but significant timeline distortion: I'm trying to convert a full-length feature film file (1:52:07:01) from the source file, which is full HD at 25 fps to .m2v in NTSC for use on DVD. The picture quality is e
-
I'm having problems adding a device to IME. I have two 4240s which are both running 6.2(1)E3, and I want to add them into IME 6.2 but experiencing problems. When I click add and enter in the device details (name, IP address, username and password) an
-
Images with embedded hyperlinks do not function in Yosemite Mail
I'm running Yosemite 10.10.2 on a 2012 iMac. I send out a newsletter with images and hyperlinks embedded in those images. You click on an image, and your browser takes to to a specified web location. In Yosemite, Mail allows you to embed hyperlinks i
-
Switching to new apple id?
when i got my first ipod way back when it was a gift and my parents set up me and my sister with the same apple id. Now my whole family has apple products and we are all on the same id. I am now in college and when I got my macbook i set up my own ap
-
Hey guys, I have an Iphone 4S, with IOS 7 operating system. Replaced screen and phone would not charge. Took it to Phone Repair store, they replaced the battery, seemed to be the only problem at the time. Battery refused to charge, took back to sh