Read a file, calculate the momentum of two columns and calc a summation of them
I have a file which das three columns. The first of them isn't important for this problem. I have to read the second and the thid ones, and then mutiply them (to calculate the momentum), if they are at the same line. After that I need to sum all the results that I calculated.
How can I do this?
If all the data in the file are numeric values you can use the Read From Spreedsheet File VI to get the 2-D array of data. Then use the index array function and index out column 1 and 2. Then multiple the arrays together, and then there is a Sum array elements VI that should finish it off.
See the attached image
Attachments:
Temp.JPG 19 KB
Similar Messages
-
How to calculate the sum of multiple columns and enter it into a single col
I have a table tab_contributions which has the following columns:
Emp_code Current_month(format: yyyymm) Contribution_amt
Sample entry:
Emp_code Current_month Contribution_amt
100 200910 100
100 200911 100
100 200912 100
100 200912 100
100 201001 100
100 201002 100
100 201003 100
Desired output: Table_result
Emp_code Years Contribution_amt
100 2009-2010 700
Also, the years duration should be of only one year. For eg: 2008-2009, 2009-2010 etc.
Edited by: user9027633 on Feb 26, 2010 12:34 AMSelect Emp_code, min(substr(Current_month,1,4))||'-'||max(substr(Current_month,1,4)) period, sum(Contribution_amt) amount
from mytable
group by Emp_code;
SQL> with mytable as (
2 select 100 Emp_code, 200910 Current_month, 100 Contribution_amt from dual union all
3 select 100, 200911, 100 from dual union all
4 select 100, 200912, 100 from dual union all
5 select 100, 200912, 100 from dual union all
6 select 100, 201001, 100 from dual union all
7 select 100, 201002, 100 from dual union all
8 select 100, 201003, 100 from dual)
9 Select Emp_code,
10 min(substr(Current_month,1,4))||'-'||
11 max(substr(Current_month,1,4)) period,
12 sum(Contribution_amt) amount
13 from mytable
14 group by Emp_code;
EMP_CODE PERIOD AMOUNT
100 2009-2010 700Max
http://oracleitalia.wordpress.com
Edited by: Massimo Ruocchio on Feb 26, 2010 9:11 AM
Added example -
Including both the Jquery script to calculate the total of calculated column and freeze header row
Hi
I managed to get this code from here,
http://techtrainingnotes.blogspot.in/2013/03/freezing-title-row-of-sharepoint-2010.html done on the page
I also managed to get this code from here, http://www.sharepointed.com/2012/11/28/jquery-total-calculated-column-in-sharpoint-2010/ done on another page.
However, I need this to be done on the same page. When I do this, I only get the freeze header thingy to be up and not the calculated column. Could something be blocking.Hi,
You take the code below for a try in your environment after modified it a bit to suit the structure of your page:
<script type="text/javascript" src="../../SiteAssets/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
// update the list after the page has loaded
_spBodyOnLoadFunctionNames.push("TTNListScroll");
function TTNListScroll()
// Scrolling list code from TechTrainingNotes.blogspot.com
// Edit the next line with your list's summary name
var SummaryName = "List28_frozenheader ";
var TTNmyTable;
var TTNListDiv = document.createElement('div');
var TTNHeadingDiv = document.createElement('div');
var tables = document.getElementsByTagName("table");
for (var i=0;i<tables.length;i++)
if(tables[i].summary == SummaryName)
TTNmyTable = tables[i];
break;
if(TTNmyTable == undefined)
// // Table not found!
// you may want to comment out the next line after testing
alert("table '" + SummaryName + "' not found");
return;
// make a copy of the table for the heading area
TTNHeadingDiv.appendChild(TTNmyTable.cloneNode(true));
TTNHeadingDiv.id="TTNheading";
TTNListDiv.appendChild(TTNmyTable.cloneNode(true));
TTNListDiv.id="TTNlist";
TTNListDiv.width="100%";
// udpate the page
var TTNnode = TTNmyTable.parentNode;
TTNnode.replaceChild(TTNHeadingDiv, TTNmyTable);
TTNnode.appendChild(TTNListDiv);
// hide the heading row of the main list
TTNListDiv.childNodes[0].rows[0].style.visibility='hidden';
// make the DIV for the heading the same width as the main list
TTNHeadingDiv.childNodes[0].style.width = TTNListDiv.childNodes[0].offsetWidth;
getSum(3);
//pass the column number to this function
function getSum(col)
var m = "$"; //change to "" for non-money format
var arrayList = $("table.ms-listviewtable:first> tbody> tr:gt(0)").find(">td:eq("+col+")");
var x = 0;
var p1 = "";
var p2 = "";
$.each(arrayList, function(){
//console.log('$(this).text(): '+$(this).text());
x += Number($(this).text().replace(/\$|,|\)/g, "").replace(/\(/g,"-"));
//console.log('x: '+x);
//format for negative numbers
if (x < 0)
p1 = "(";
p2 = ")";
x = Math.abs(x);
$('#diidSortcal').attr('visibility','visible');
$('#diidSortcal').text($('#diidSortcal').text()+'(sum: '+x+')');
function addCommas(nStr)
//formats number
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1))
x1 = x1.replace(rgx, '$1' + ',' + '$2');
return x1 + x2;
</script>
<style type="text/css">
#TTNheading
height:28px;
#TTNlist
height:200px;
overflow-y:scroll !important;
overflow-x:auto
</style>
Then you might get something like this:
Feel free to reply if there are still any questions.
Best regards
Patrick Liang
TechNet Community Support -
Adding the value of two columns and place to 3rd column in jtable
hi all,
i have table with 3 columns with rows
say for example --loan, interest, total
i want add loan+interest and place into total column.
how can i do this?
thanks in advance
dayaUse a TableModelListener:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=566133 -
I want to compare two columns and replace any equal values with the value in a specific cell
I want to compare the numbers in two columns and replace all matching numbers in the second columns with the corresponding value from a cell in the same row as the matching number.
Me too.
Barry -
To calculate the difference between two periods in SSM
Hi,
I have two questions need to be clarified.
Question 1: I have KPI named Revenue growth and the formula to calculate is (current year revenue - previous year revenue).I am using data entry& approval.Is that technically possible to calculate the revenue difference between two periods in SSM?
Question 2: Is that possible to enter the date as input for the variable?for example i want find the difference between two dates and the difference value is output for my variable.
Regards
BalaHi:
Question 1:
We have same problem, and what we did is to create:
- 2 NON KPI:
R1 = Revenue current year
R2 = Revenue previous year
- 1 virtual KPI
R3 = R2-R1
Question 2:
I don't know.
Regards. -
How to Calculate the Time Between two days in ABAP
Hi,
I have one scenario like i need to calculate the time between two days please can you suggest me.
Thanks,
HarinathHi Peeleti,
Check this code,
DATA : DATE1 LIKE SY-DATUM VALUE '19830125',
DATE2 LIKE SY-DATUM VALUE '20070219',
DAYS1 TYPE I,
WEEK1 TYPE I,
MONTH1 TYPE I,
YEAR1 TYPE I,
C_YEARS1 TYPE I.
CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'
EXPORTING
BEGDA = DATE1
endda = DATE2
TAB_MODE = ' '
IMPORTING
DAYS = DAYS1
C_WEEKS =
C_MONTHS = C_YEARS1
C_YEARS = C_YEARS1
WEEKS = WEEK1
MONTHS = MONTH1
YEARS = YEAR1.
D_MONTHS =
MONTH_TAB =
*WRITE : / 'DAYS = ', DAYS1,
/ 'WEEKS = ',WEEK1,
/ 'MONTHS = ', MONTH1,
/ 'YEARS = ', YEAR1.
Using this code you can calculate the No Of Days Between two dates. Based On days you will easily calculate the Hour. [ No of days * 24 ].
Thanks.
Reward If helpful. -
Calculate the difference between two dates times in infopath form 2013
Hi,
I have an infopath 2013 form that contains three fields:
2 date time and the 3rd contains the difference between the two in hours
how I can make the difference between the two so that the display will be like this:
Date Time1 08/21/2014 22:00
Date Time2 08/22/2014 1:00
Diff Field 3:00Hi,
Please refer to the following article which matches your requirement exactly.
Calculate the difference between two date picker controls in InfoPath using rules and formulas - no code!
Please mark it answered, if your problem resolved. -
Calculate the difference between two dates
I would like to calculate the difference between two dates in PL/SQL and return the result as a number of days expressed as an integer value.
Denes,
A fair point, I should really have posted this on the SQL forum (I'm new to the forum as well as PL/SQL) but thanks for responding anyway. It does raise a question as to how to implement this in ApEx though.
I have created the function and am calling it as shown below from the source window of a form. The source type is 'PL/SQL expression or function' and the expression in the source window of the form is:
calc_date_difference (:p26_c_payment, :p26_c_rec)
The two parameters being passed are of type date but I'm not sure how to handle the ruturned number and populate the form in ApEx with this value.
Is it possible to do it this way or am I taking completely the wrong approach?
Regards
Sandy
This is not ApEx related but SQL related:
CREATE OR REPLACE FUNCTION calc_date_difference (
p_date_1 VARCHAR2,
p_date_2 VARCHAR2
RETURN NUMBER
v_difference NUMBER;
v_sql_err VARCHAR2 (4000);
BEGIN
v_difference := TRUNC (TO_DATE (p_date_1)) - TRUNC
(TO_DATE (p_date_2));
RETURN v_difference;
CEPTION
WHEN OTHERS
THEN
v_sql_err := SQLERRM || CHR (10) || CHR (10) ||
SQLCODE;
ND calc_date_difference;and
SQL> SELECT calc_date_difference ('23.01.2007',
'20.01.2007') diff
2 FROM DUAL;
DIFF
3
Denes Kubicek -
Calculate the variance between two row
Post Author: jane
CA Forum: WebIntelligence Reporting
Hi,
I'm new to BO and wondering whether there is a way to calculate the variance between two rows. I'm working on a report which requires to display the change of two day's data. For instance, I have a table in a format as
Date
Sales Amount
3/12/2008
2300.00
2/12/2008
1280.00
Changed
1020.00
I'd like to display the "Changed" column. Is there a way to do that in BO InfoView? In Excel, you can use the formular by identify the two cells.
Thanks!Post Author: Vinl
CA Forum: WebIntelligence Reporting
I am having the same problem and am steping outside of the box and cannot progress.
Seems to me that you are kind of saying that the only way to get around this is to create an individual object in Designer? I cannot find a way of cementing values as a variable in order for a variance to be created.
I am trying to do it at column level mind you, which should not make that much difference....
Simple SQL database. I have created an object called "Year" which takes a date and converts it to a year. I then have another object created "Total sales", put the 2 in a table get the right results...try and create a year on year variance from that...no chance...
Used to work ok...? -
Reading trace file on the fly.
I came across one cool trick mentioned by Tanel Poder, but it doesn't seem to work for me. Could anyone please help in reading trace file on the fly.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> !uname -a
Linux abc 2.6.16.60-0.34-smp #1 SMP Fri Jan 16 14:59:01 UTC 2009 x86_64 x86_64 x86_64 GNU/Linux
SQL> select value ||'/'||(select instance_name from v$instance) ||'_ora_'||
2 (select spid||case when traceid is not null then '_'||traceid else null end
from v$process where addr = (select paddr from v$session
3 4 where sid = (select sid from v$mystat
5 where rownum = 1
6 )
7 )
8 ) || '.trc' tracefile
9 from v$parameter where name = 'user_dump_dest'
10 /
TRACEFILE
/n01/oraadmin1/diag/rdbms/abc/inst1/trace/inst11_ora_28754.trc
SQL> host mknod /n01/oraadmin1/diag/rdbms/abc/inst1/trace/inst11_ora_28754.trc p
SQL> set define off
SQL> host grep "WAIT" /n01/oraadmin1/diag/rdbms/abc/inst1/trace/inst11_ora_28754.trc &
SQL> set define on
SQL> alter session set events '10046 trace name context forever, level 8';
Session altered.
SQL> select * from dual;
D
X
SQL>
SQL> select * from dual;
D
X
{code}
I dont get any WAIT printed into the pipe file created before tracing.
Am i doing something wrong here ?
Edited by: Yasu on Nov 12, 2012 10:14 AMI tried manual method and yes i am able to find WAIT lines in trace file.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> select value ||'/'||(select instance_name from v$instance) ||'_ora_'||
(select spid||case when traceid is not null then '_'||traceid else null end
2 3 from v$process where addr = (select paddr from v$session
4 where sid = (select sid from v$mystat
5 where rownum = 1
6 )
7 )
8 ) || '.trc' tracefile
9 from v$parameter where name = 'user_dump_dest'
10 /
TRACEFILE
/n01/oraadmin1/diag/rdbms/proddba/proddba1/trace/proddba1_ora_23021.trc
SQL> alter session set events '10046 trace name context forever, level 8';
Session altered.
SQL> select * from dual;
D
X
SQL> alter session set events '10046 trace name context off';
Session altered.
SQL> !ls -lrt /n01/oraadmin1/diag/rdbms/proddba/proddba1/trace/proddba1_ora_23021.trc
-rw-r----- 1 oracle oinstall 2738 2012-11-12 01:13 /n01/oraadmin1/diag/rdbms/proddba/proddba1/trace/proddba1_ora_23021.trc
SQL> !grep "WAIT" /n01/oraadmin1/diag/rdbms/proddba/proddba1/trace/proddba1_ora_23021.trc
WAIT #1: nam='SQL*Net message to client' ela= 6 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=1352704368368424
WAIT #1: nam='SQL*Net message from client' ela= 4057810 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=1352704372428142
WAIT #1: nam='SQL*Net message to client' ela= 6 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=1352704372428492
WAIT #1: nam='SQL*Net message from client' ela= 195 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=1352704372428892
WAIT #1: nam='SQL*Net message to client' ela= 3 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=1352704372428939
WAIT #1: nam='SQL*Net message from client' ela= 46319788 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=1352704418748740Not sure why using mknod fails in my case.
Edited by: Yasu on Nov 12, 2012 12:48 PM -
I can't read a file with the ext PDF the sender informed me that the file was reset to PDF.
I can't read a file with the .ext PDF the sender informed me that the file was reset to PDF. But when I tried to open it the caption box informed me"the file is not in PDF format. I suspect the sender simply changed the file .ext which is why I can't open it! What can I do about it! I am working on an iPad.
Thanks
Mr Jim LapthornIf the document is not, in fact, a PDF, then you will need to get your sender to provide a PDF.
Can you open this document in any other application? -
I have a problem with the mac can not read video files with the extension IMOD. How can I solve this problem?
By doing a Google search.
-
Is it possible to read Prezi files within the iOS app?
Hello,
I want to implement Prezi into my iOS app. I am totally unaware that "Is it possible to read Prezi files within the iOS app?".
If Yes, please provide some tutorial link, so that I can implement into my application.
Thanks & regard.You will get a better answer in
Developer Forums
Use your Developer credentials to log in there. -
I removed chrome 10 and newly installed FF4 final, and I can't read PDF files within the browser. There was no problem in Chrome. I can't even see the acrobat reader plugin in the plugins page. Acrobat 10 is already installed in my PC. Every time I try to read a PDF file on the web, FF tries to download it instead.
As recommended above by Bernd Alheit, I posted this on the Adobe Reader forum. There, I received the advice to repair the installation under the help menu, which I did and it fixed the problem.
Similar to your solution but found it's a fix found under "HELP" menu and not Add/Remove.
Thank you.
Maybe you are looking for
-
Sites using TALEO for job searches no longer works in 19, worked in last official 18 release
Company websites which use the TALEO job search/apply app/site, no longer work right in 19, they worked fine in 18.xx. Specially, the job search function does not work right when entering the TALEO job search parameters then hitting SEARCH FOR JOB do
-
After an upgrade to 1.2.1, I now see a lot of auth failed entries with an Identity/Endpoint ID of 00:00:00:00:00:03. I dont see this MAC on the switch port of the NAS where ISE reports it. Anybody know what this is and how to stop it from happening?
-
STO's are not showing up in VL10I Transaction.
Hi Gurus, I have a scenario wherein the delivery has been created for the 1st line item of the STO. when we try creating the delivery for the rest of the line items in the same STO, they dont show up in the VL10I screen. Could you please help me out
-
Mapping function module paramters dynamically with a selection screen
Hi Experts, I got a situation, i am maintaining data of a function module paramters in a dictionary table. in the screen pbo i will fetch the the fm data from that table into the internal table(ITAB). in my report screen i am having the selection scr
-
CS3 Distribute problem (only moving right-most object).
I am having a problem with the Distribute option using a set distance. In today's example, I have an image and a caption. The image is locked in place. If I place the caption to the right of the image, I can use the Distribute option to set the space