Summing column values in sortable dataset
http://cccw.ecologik.net/admin/lookup/
Simple page that has a reapting region that is sortable. You notice at the bottom of the table I have a "Total Saved." I would like this to be able to sum up the pSaved column. I know I could get this dynamically when I first create the table in php but once the user sorts, how can I recount the pSaved column? I would think this is a common request but can't seem to find anything about it out there!
Thanks for any help in advance.
Jon
Thanks for the response. After a bit of digging I came up with a solution myself.
I simply added decided to sum the fields as they went through the filterFunc()
if (!document.getElementById("containsCB").checked)
regExpStr = "^" + regExpStr;
sumOfFields=0
var regExp = new RegExp(regExpStr, "i");
var filterFunc = function(ds, row, rowNumber){
var columnNames = ["Last","First","email","watershed","pledge","City"],
result = false;
for( var i = 0; i < columnNames.length; i++ ){
// search for a match
if( row[ columnNames[i] ] && row[ columnNames[i] ].search( regExp ) != - 1 ){
result = true;
sumOfFields=sumOfFields + Number(row["pSaved"])
break; // stop looping.
on the table page itself I added small piece of code.
<script type="text/javascript">
document.getElementById("resultsArea").innerHTML=sumOfFields;
</script>
Works like a charm! Thanks again for the input!
Similar Messages
-
ADF Table: sum of column value
Hi Experts,
I have a editable table which is having "Quantity of Volume" column.When user ll input the value in to this,Then the lower panel should show the sum of Volume. How I ll do this? Below is my table src code:
<af:table value="#{bindings.NominatedAllocationType2.collectionModel}"
var="row" rows="#{bindings.NominatedAllocationType2.rangeSize}"
emptyText="#{bindings.NominatedAllocationType2.viewable ? 'No data to display.' : 'Access Denied.'}"
fetchSize="#{bindings.NominatedAllocationType2.rangeSize}"
rowBandingInterval="0" id="t2">
<af:column sortProperty="TheQuantityOfVolume" sortable="false"
headerText="#{bindings.NominatedAllocationType2.hints.Volume.TheQuantityOfVolume.label}"
id="c6">
<af:inputText value="#{row.Volume.bindings.TheQuantityOfVolume.inputValue}"
label="#{bindings.NominatedAllocationType2.hints.Volume.TheQuantityOfVolume.label}"
required="#{bindings.NominatedAllocationType2.hints.Volume.TheQuantityOfVolume.mandatory}"
columns="#{bindings.NominatedAllocationType2.hints.Volume.TheQuantityOfVolume.displayWidth}"
maximumLength="#{bindings.NominatedAllocationType2.hints.Volume.TheQuantityOfVolume.precision}"
shortDesc="#{bindings.NominatedAllocationType2.hints.Volume.TheQuantityOfVolume.tooltip}"
id="it1">
<f:validator binding="#{row.Volume.bindings.TheQuantityOfVolume.validator}"/>
<af:convertNumber groupingUsed="false"
pattern="#{bindings.NominatedAllocationType2.hints.Volume.TheQuantityOfVolume.format}"/>
</af:inputText>
</af:column>
</af:table>
Thanx
AswiniHi.
Check
Calculate Sum in VO issue again
http://technology.amis.nl/blog/1295/creating-a-dynamic-ajax-column-footer-summary-in-a-table-component-using-adf-faces -
How can I sum the values in a given column on sheet 1 i.e. A1:A50 based on the adjacent columns specific value i.e. B1:B50 = “Dinning Room” on sheet 2
For Example:
SHEET 1
A
B
$50
Dinning Room
$800
Dinning Room
$300
Kitchen
$1,000
Master Bedroom
$100
Dinning Room
SHEET 2
Display the total SUM amount of each Project based on Sheet 1
Project Name
Total Cost
Dinning Room
$950
Kitchen
$300Would be a good idea to open iWork Formulas and Functions User Guide and search for the description of the function named SUMIF
The Guide is available for every user thru the Help menu.
Yvan KOENIG (VALLAURIS, France) jeudi 19 mai 2011 17:32:42
Please :
Search for questions similar to your own before submitting them to the community
To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer ! -
How to get sum of highlighted column values.
Is there currently any functionality that allows you to highlight a certain number of column values in the returned result set and to see the sum of the values highlighted.
Hi,
Not directly, sorry.
You could always try highlighting the desired cells, copy/paste them into a column in a spreadsheet like MS Excel or Open Office Calc, then add a sum function into a nearby open cell. The spreadsheet can be added to SQL Developer's Tools|External Tools menu for convenience.
Regards,
Gary Graham
SQL Developer Team -
Auto sum Column accumulated value in gridview
The principle seems simple but I'm in trouble. Did anyone have an example or script to auto sum of a column in the gridview. Explain, I have a gridview with the columns:
amount, unitary value, total value and accumulated value. I need the accumulated value column add the previous value
to the current value. For example:
quantity unitary_value total_value accumulated_value
10 10,00 100,00 100,00
20 50,00 1.000,00 1.100,00
5 500,00 2.500,00 3.600,00
Basically it would be up. The column value (accumulated value) takes the value of the previous line and adds to the current value.
If you can help !!
Thank you for your attention.
Thank you for your attention.No you're right with the calculation of the first post, I got it wrong. Now check the below solution, you need to use RowDataBound event of the gridview to do the calculation and print in the cell:
//This is just a method to fill the datatable with dummy data(you can ignore in your code)static DataTable GetTable()
// Here we create a DataTable with four columns.
DataTable table = new DataTable();
table.Columns.Add("quantity", typeof(double));
table.Columns.Add("unitary_value", typeof(double));
table.Columns.Add("total_value", typeof(double));
table.Columns.Add("accumulated_value", typeof(double));
// Here we add five DataRows.
table.Rows.Add(10, 10, 0, 0);
table.Rows.Add(20, 50, 0, 0);
table.Rows.Add(30, 40, 0, 0);
return table;
protected void Page_Load(object sender, EventArgs e)
//Bind the gridview to the datatable
GridView1.DataSource = GetTable();
GridView1.DataBind();
//Global var to keep accumulated value of each rowo
double _accumulatedvalue = 0;
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
if (e.Row.RowType == DataControlRowType.DataRow)
//Create total value column by multiplying cells 1 and 2(maybe you don't need this)
Double val = Convert.ToDouble(e.Row.Cells[0].Text) * Convert.ToDouble(e.Row.Cells[1].Text);
e.Row.Cells[2].Text = val.ToString();
//Accumualated value and fill the cell related (you can replace val below with Convert.ToDouble(e.Row.Cells[2].Text)
_accumulatedvalue = _accumulatedvalue + val;
e.Row.Cells[3].Text = _accumulatedvalue.ToString();
Fouad Roumieh -
I am looking for a way (action script code?) to sum datagrid
column values.
I am using Flex2 with Cold Fusion MX7.
I populate a DataGrid by setting dataprovider to the result
of a Coldfusion query.
(this.masterList.dataProvider = event.result as
ArrayCollection;)
This all works fine.
The masterList datagrid has debit, credit, and unitcost
columns. I want to sum those columns individually, and display the
results in text boxes in another panel.
I could run a Coldfusion query to return the sums, but would
like to do it on the client side with action script.
I want to sum them everytime I update the datagrid, so need
action code that I can put in the result function.
I am new to ActionScript, and not sure how to loop through
the array collection(and/or) dataprovider and sum the items.
Any help would be appreciated.
Thanks.Loop through your array..if the arrayCollection was named
myArray;
private sumFunction():Number{
var sum:Number=0;
for(var i:uint=0;i<myArray.lenght;i++){
sum+=myArray
.debitValue;
return sum; -
How to sum a column value using CAML Query?
Hi All,
I would like to sum the column value using CAML qeury. Actually in my list, I have two column "Projects Name" and "Number of Issues". Now need to get sum of "Number of Issues" column. How to achieve in CAML Query.
Thanks in advance!Hi Sam,
it looks like you can use your current view based agregation, otherwise it is not possible(
http://msdn.microsoft.com/en-us/library/ms467521.aspx) and you need to work on custom bit on this requirement.
use the below link and create a view element as described and see if that works for you
Aggregations Element
http://msdn.microsoft.com/en-us/library/ms468626%28v=office.12%29.aspx
Another reference
Query Element
http://msdn.microsoft.com/en-us/library/ms471093.aspx
Hope this helps!
Ram - SharePoint Architect
Blog - SharePointDeveloper.in
Please vote or mark your question answered, if my reply helps you -
Sum of values in a column in alv
i am displaying data in a hierarchical list using OO programming.
I have created a hot spot for a particular field so that i display a
popup on clicking any value in that column.
The popup displays another alv grid.
I need to sum up the values of a particular column in that a;v grid
that is displayed in the popup using OO prog.
Could anyone suggest a mthod that helps summing the column values/Hello Rohan,
Hope you are ready with the event handler method and other supporting stuff. Only thing missing is before calling second screen you need to set DO_SUM field in field catalog table and pass that field catalog for the second alv.
Refer to SAP help [http://help.sap.com/saphelp_47x200/helpdata/en/52/5f0607e02d11d2b47d006094192fe3/frameset.htm] for more details.
Thanks,
Augustin. -
Dear All,
I want to configure a FMS at a title level UDF. I wolud like to save the sum value of a column values in that title field.
For example,
A B
1 10000
2 10000
3 10000
4 10000
40000
I want to reflect the 40000 value in a title level UDF through FMS.
How can I write a query for this requirement??
Thanks in advance...
Regards,
Suresh YerraDear István K#rös,
Thanks. I have posted this question, is there any way to get the solution without doing coding. To solve this we need to use SDK.
Thank you once again for your quick response.
Thanks,
Suresh Yerra -
DAX: Sum unique values across columns
Hello,
How do I sum unique values of "Yes" across my columns in DAX?
It should look like this with [Total Yes] being my calculated column:
Name
January
February
March
Total Yes
Bob
Yes
Yes
No
2
Jim
No
Yes
No
1
Mark
No
No
Yes
1
Thanks!
~UGSimply this
=IF([January]="Yes",1,0)+IF([February]="Yes",1,0)+IF([March]="Yes",1,0)
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
SSRS - Expression to color column value dynamically in Matrix
Hi ,
I have a matrix which looks like :
The <<Expr>> value can be 1 /0 /"-" .
The Expr value is being calculated dynamically.
The data set query I am using has a column called due_days.
In the color expression of the <<Exp>> box I am using the expression as :
=IIf(Fields!Due_Days.Value>14 and Fields!Notes_Count.Value>0,"Blue",(Iif(Sum(Fields!Notes_Count.Value)=0 ,"Red","Black")))
My requirement is if the Due_Days column value is >14 then I need to highlight the value as blue else black and if value is 0 then red. When I use the above query it is just highlighting the color blue for 1st column only. Eg: 4th row . Due days for month
of Oct and Nov is > 14 but it shows blue only for month of oct.
How can i resolve the issue?In select query i have 5 columns:
Due days(Which is difference between 2 dates) ,
Notes count (Which is just a count of notes entered or not having value 0/1 and value '-' if another column CRD is greater than the matrix month and year.)Eg: below date 11/12/2014 is greater than Oct 2014 hence Oct 2014 should have "-"
Month Name , Year , Month Nbr (last 6 months which I cross joined with the table to get counts for each month)
The matrix has year and last 6 month as column groups
Color coding should be if notes count is 0 then red ,if notes count is 1 and due_days> 14 then blue else black . When i try to use expression for color as i mentioned above, it colors only 1st colum.eg: 2nd row
Nov 2014 is blue but for jan 2014 also it should show blue as due days>14 .
Is there any way i can do that ??
Eg: data set returns value as :
Due Days CRD Month
Month_Nbr Year Notes _Count
5 2014-11-28 00:00:00.000 December 12 2014
0
5 2014-11-28 00:00:00.000 February 2 2015
0
5 2014-11-28 00:00:00.000 January 1 2015
0
5 2014-11-28 00:00:00.000 November 11 2014 1
5 2014-11-28 00:00:00.000 October 10 2014 0
5 2014-11-28 00:00:00.000 September 9 2014 0
Matrix is of the form :
YEAR
MONTH
CRD Notes_count -
Sum distinct values grouped in ssrs expression
Hi ALl
Need help in writting an expression
I have this kind of data
C1 L1
10
C1 L2
10
C1 L3
10
C2 L1
3
C2L2
3
C3 L1 6
C3 L2
6
Need to write an expression in SSRS calculated fieldwhich will sum only C1L1 + C2 L1 +C3L1?
Is this possible ? Can somebody please helpHi,
After testing the issue in my local environment, we can refer to the expression below to achieve your requirement (supposing that the L1,L2,L3 in col2 field, 10,3,6 in value field, the dataset named DataSet1):
=SUM(IIF(Fields!col2.Value="L1",Fields!value.Value,0),"DataSet1")
If there are any other questions, please feel free to ask.
Thanks,
Kathrine Xiong
Katherine Xiong
TechNet Community Support -
Sum the values of a text field in a tabular form using JavaScript
Hi Folks.
OK, I put my hands up. I don't know Java script but I'm picking up the basics and I WANT to learn.
Here's my situation.
I have a tabular form which has lots of Standard Report Columns and ONE text field.
I want to sum the values entered in the text field, real time, using Java Script without the need to have a round trip to the database.
I'm guessing this will involve some kind of loop. Once I have that SUM figure I will store it in a hidden item and it will be used for validation when the user submits the form.
If anyone can give me a simple Java Script to do this, or point me in the direction of one, I'd be very grateful.
Many thanks.
Dogfighter.Hi Arie.
Thanks for the link.
That's a great start,
What I've got working so far is the following...
<script type="text/javascript">
function f_calculate_delta(p_this,p_rownum)
var amt = $x(p_this).value;
alert (amt);
var display_item_to_set = 'f08_'+ p_rownum
$x(display_item_to_set).innerHTML = amt
</script>
This is working fine.
Where I'm stuck at the moment is how I can 'get' the value of another cell in the same row. They have all been set up using the APEX_ITEM API with their own unique IDs.
I will continue looking but if you could give me a steer, that would be great.
Many thanks
Simon
PS. APEX 3.1
PPS. Trying to get the value of another row using...
var display_item_to_get = 'f04_'+ p_rownum
var expected_amt = $x(display_item_to_get).value
PPPS. Also tried...
var display_item_to_get = 'f04_'+ p_rownum
var expected_amt = $v(display_item_to_get)
and
var display_item_to_get = 'f04_'+ p_rownum
var expected_amt = $v(display_item_to_get).value
None of which are working at the moment.
Message was edited by:
Dogfighter -
Add sort, filter, export to excel and summation of tab column values in VC
Hi,
Can anyone help me out in providing the following functionalities in the Visual Composer tableUI element :
1. Sort
2. Filter
3. Export to Excel
4. Summation of Table Column Values
5. Update entry in table
6. Create entry in table
Thanks in advance.
Wish you great time.
Best Regards
SidHello Sid,
1. Sort
--> This is a standard functionally of tables in VC
2. Filter
--> Use the filter element of VC
3. Export to Excel
Go to: Sdn>Wiki>VC>Modeling>Export data to Excel/PDF
4. Summation of Table Column Values
--> This depends on your data source. If you use BI queries you have this normally automatically. If not you can use the sum element of VC.
5. Update entry in table
6. Create entry in table
> see Sdn>Wiki>VC>Modeling-->Moving data between tables
Kind regards
Thomas -
Render a column based on other column value in the same table
JDev 11.1.1.6.0
This may be a silly question but I am stuck
I need to conditionally render a column say A. Condition is like if the value in the other column B of same table is equal to F. I should render column A only when this condition is satisfied. I have tried the following code:
<af:column sortProperty="PhoneNumber1"
sortable="false"
headerText="#{bindings.A.hints.PhoneNumber1.label}"
id="c146"
rendered="#{row.PhoneNumber1ResponseFlag eq 'F'}">
<af:outputText value="#{row.PhoneNumber1}"
id="ot130"/>
</af:column>
<af:column sortProperty="PhoneNumber1ResponseFlag"
sortable="false"
headerText="#{bindings.B.hints.PhoneNumber1ResponseFlag.label}"
id="c80" rendered="true">
<af:outputText value="#{row.PhoneNumber1ResponseFlag}"
id="ot129"/>
</af:column>
The data shown in the table for column PhoneNumber1ResponseFlag is F. Still my condition is not working.Timo was saying that it is not possible to render the column in some situations and not in anothers, you will always have to render the column.
The best way to do this is instead of showing a column with the text ' ', show something meaningfull to the user. This is a DataWarehouse advice to you and may be usefull since you're using ADF in a area that uses DataWarehouse..
So the code could be something like this (based on Timo's code):
<af:column sortProperty="PhoneNumber1"
sortable="false"
headerText="#{bindings.A.hints.PhoneNumber1.label}"
id="c146">
<af:outputText value="#{row.PhoneNumber1ResponseFlag eq 'False.' ? row.PhoneNumber1 : 'No value applied.'"
id="ot130"/>
</af:column>
<af:column sortProperty="PhoneNumber1ResponseFlag"
sortable="false"
headerText="#{bindings.B.hints.PhoneNumber1ResponseFlag.label}"
id="c80">
<af:outputText value="#{row.PhoneNumber1ResponseFlag}"
id="ot129"/>
</af:column>
Hope that helps,
Frederico.
Maybe you are looking for
-
Hi All Could you please share the UK PAYE EOY functional changes for 12-13. Thanks Sumesh
-
About inter-relation B/W MM-PP-SD and Fico module
Hi to all Plz describe me interrelation b/w MM-PP-SD and Fico module . If possible send me work-flow of these modules which is required to know for an ABAPER. Also tell me how a n ABAPER interact with a functional consultant . Thanks & Regards Anubh
-
Is it possible to get the name and path of a imported xml with javascript? Thanks!
-
I was collaborating for the first time with a client and thought that, if she uploaded photos to the folder I shared/collaborated with her, that I could just select them all at once and download. Not the case. I feel this needs to be updated and perf
-
HI Gurus In Material Master - WM1 view, there is a field capacity usage. Is there a formula to calculate the capacity usage or its a free field where you can enter any number? Please advice Thanks Sanjay