Finding average value
Hi,
how to find the average of array like (1,2,3,4)using bls?
Please give me the solution for this query.
points will be rewarded.
Thanks&Regards
Gurunadh.
Hi Gurunadh,
you can use the Aggregate Statistics action block for this (under XML Functions in BLS editor) - it will give you average (mean) and a few other statistical values in one execution.
However, this action only works on numbers which are in one column.
This is also in the xMII help - http://help.sap.com/saphelp_xmii115/helpdata/en/Business_Logic_Services/aggregatestatistics.htm
Sascha
Similar Messages
-
Finding the average value of related structure keys
Issue:
I have a form structure which I need to find the value
averages of all the *AGE keys, *MINORS keys, and *ADULTS keys.
Here's my example form structure, after using
structkeyarray() of coarse:
1 RES_ROOM2_MINOR3_AGE
2 RES_ROOM1_MINORS
3 RES_ROOM2_MINOR1_AGE
4 RES_ROOM1_MINOR2_AGE
5 RES_ROOM3_MINOR1_AGE
6 RES_ROOM2_MINORS
7 RES_ROOM3_MINOR2_AGE
8 RES_ROOM3_ADULTS
9 RES_ROOM3_MINORS
10 RES_ROOM1_ADULTS
11 RES_ROOM2_ADULTS
12 RES_ROOM1_MINOR1_AGE
13 RES_ROOM2_MINOR2_AGE
Question:
How should I AT LEAST go about pulling out each set of keys
so i can procede to find the mean?Such as...
cfset keys = structkeylist (form)
- cfloop index='x' list='keys'
- - cfif x contains AGE/MINORS/ADULTS blah
- - cfset blah
- /cfloop
I guess that should definitely work. Simple no less. I got
caught up
looking for a special function to run through the structure.
Thanks for
shaking my head up, and sending me on my way. ;-)
That's the idea. If you care, you can use the collection form
of the
<cfloop...> tag. Eliminates the need to pull out the
list of keys
separately.
<cfloop collection="#form#" item="field">
<cfif field contains "AGE|MINORS|ADULTS|Ect">
process
</cfif>
</cfloop> -
How do you find the average value of all the data between two points on a single channel
I am tring to calculate the average value of all the data points on a single plot between two seperate points
I have attahced an illustration.
Tim
Solved!
Go to Solution.
Attachments:
plot.jpg 173 KBHey smoothdurban,
I've seen Brad's code, and trust me, it's worth the effort to let him help you get it up and running - it's definitely the most ideal way to solve this problem. However, as Brad said, there are multiple ways to tackle this - both interactive and programmatic - so in the meantime, I'll take a second to detail one of the interactive and sure-fire ways to find the average of data between two points on a single channel.
We'll use"Flags." Set up your VIEW graph exactly as you did on your original screenshot, using Band Cursors to approximate the beginning and ending X-values representing the range you want to examine. Next:
1. Click the "Set Flags" button () that is a part of your 2D Axis System. Note that you can hold down the Shift button if you ever decide you want to do this on more than a single curve at one time.
2. Select the "Flags: Copy Data Points" button that enables after Flags are set.
3. This creates new channel(s) in the default (bold) group in the Data Portal that contains only the Flagged data.
4. Select DIAdem ANALYSIS.
5. Select Statistics » Descriptive Statistics.
6. In the Channels input, select the newly created channel containing your Flagged Y-Data.
7. Ensure that the Arithmetic Mean parameter is set. You can preview the data and the result in the dialog before pressing OK to execute the calculation.
You may have noticed that in the Descriptive Statistics calculation, one of the parameters that you can set is the range of channel rows to operate on - so, if you know the row numbers of your beginning and ending X-values, you could just simply run the Descriptive Statistics calculation and use this parameter to operate on a row subset of your original channel instead of the entire channel.
Derrick S.
Product Manager
NI DIAdem
National Instruments -
Where can I find the moving average value of Project stock
Dear All
All my company stock is project stock. For all my Goods Issues with 221 Q, system takes the moving average value for that consumption posting. Where this moving average value can be found?
Other than MBBS, is there anything else?
Thanks
Edited by: srini v on Dec 12, 2009 12:48 PMHi,
Try MM60
Regards,
Pardeep Malik -
I'm trying to take a few readings from an oscilloscope. I made a simple VI to test all of the parameters for the oscilloscope and make sure that everything was working before implementing the oscilloscope in a much more elaborate VI. I want to have voltage at a certain level (say, 2 V) then take a reading from the oscilloscope, add that value as a new element in an array. After doing this 100 times the VI will add the average value to a spreadsheet and then increase the voltage (to 2.05 V or something) and take 100 more measurments and average/record them. I was able to take ten sets of 100-sample averages and write them to an array (see notbroken.png) on one file, but when I try to do it in the real program (see broken.png) I check my spreadsheet and each entry is "0.000." Note that I've also created a program that controls the power supply independently and verified that I know how to control it properly; in fact, the only non-zero column is the one which reads the voltage that the program is telling the power supply to output.
I've literally written out each step that my "not broken" program does to find the average value and then done the same for the broken program and I can't find a single discrepancy. Any and all help would be greatly appreciated!
Solved!
Go to Solution.
Attachments:
broken.png 53 KB
notbroken.png 42 KBvweltin wrote:
I've literally written out each step that my "not broken" program does to find the average value and then done the same for the broken program and I can't find a single discrepancy. Any and all help would be greatly appreciated!
Here's an exact analysis.
Both of your programs are broken, but the one with the FOR loop iterates only 10 times, thus you get arrays with one nonzero value (the last one) when the loop terminates. (Just because the average is nonzero, does not mean it is correct!)
Your code with the while loop iterates 11 times, but your array only has 10 elements, meaning that in the last iteration you try to replace an element that does not exist and the array remains at all zeroes.
In both programs, there will never be more than one non-zero element in the array.
LabVIEW Champion . Do more with less code and in less time . -
Hi,
I have a problem. I'm reading data continuously from analog input. I want calculate average value when I press button START. Average value should be calculated from samples which are defined by 'Number of samples' and 'millisecond multiple'. When all samples are read, average vale should show.
The problem is that when number of samples is higher then 10, it doesn't work.
Can someone tell me what I did wrong?
Thanks
P.S.. I saw that there was something like this but I can't open it because I use Labview 8.5
Attachments:
Average.vi 35 KBFor that you need to store the previous value for averaging... i have attached a VI regarding that ( sorry no time to cleanup ).. You can use the logic to calculate the average of the samples (Still am not clear about you requirement).
The best solution is the one you find it by yourself
Attachments:
Average_anand.vi 26 KB -
How to find RGB values of an image in MIDP 2.0?
I am builiding a midlet in which i m supposed to take an image and than i want to find RGB values of all pixels
.After Finding the RGB values i want to store them in an array,and sort that array to find 5 Most repeated element of that array.Also i wanna construct color from those 5 Values and Display Those Colors.Can Anyone
Guide me Through This?I have not used Vision much but I would be very surprised if you would be able to do this directly. It should be straight forward to get an average intensity with or without Vision (convert image to 2D matrix and average the values, for instance) -- the difficulty will be correlating the calculated values back to Lumens, etc. This could likely be done but it would probably require you to come up with the calibration curve and would be sensitive to setup changes, dust on the lens, equipment aging, etc. and these things should not be discounted. This is why, particularly if you're in a production environment, you'd probably better off buying a commercial meter and talking to it via a driver than to try to do it yourself -- they've already taken these things into account.
One more thing, in the picture you attached, any luminosity calculations you made would probably be skewed low as the white is saturated (railed) in spots and those under-reported values would affect your average. If you did try to come up with a Lumen calculation, you would probably want to turn your aperature and/or exposure down before creating the calibration curve. -
DP macros, calculating average values over a period of time
Hello
I have a key figure row, for the future i want this key figure to contain the average of a different key figure row over the last year.
How would you go about calculating the average value of a key figure row over a period of time and then assigning this value to another key figure?
I've tried variatons of AVG() and SUM() & SUM_CALC a but none of them seem to get me anywhere, i may not understand completely how rows & values work so any tips would be helpful.
Iin pseudo-logic: what i need to do is:
Calculate the average value of a key figure row over a given period (the last year)
Store this value somewhere, in regular programming it'd be a variable of some kind.
Assign this value to another key figure row 18 months into the future.
Regards
Simon Pedersen<H5>Hi Simon,
If you are a technical guy, you can create a BADI implementation for that macro and manipulate the matrix data like the way you want.
the procedure to implement a BADI is
1.SPRO --> SAP SCM - Implementation Guide --> Advanced Planning and Optimization --> Supply Chain Planning --> Demand Planning (DP) --> Business Add-Ins (BAdIs) --> MacroBuilder --> Additional Functions for Macros.
create a new implementation by copying the class for the BADI defenition '/SAPAPO/ADVX' and write your own code in the method '/SAPAPO/IF_EX_ADVX~USER_EXIT_MACRO '. There is a sample code and proceedure explaining how to handle the data in the internal tables C_T_TAB and C_T_TAB_OLD. the calculations can be made with help of I_T_LINES, I_T_COLS which are rows and columns tables.
find out the the row and columns of the grid to be read and do calculation and then put the result in the desired cell.
Please let me know if you need further assistance.
Regards,
Srini.
Award points for the helpful answers <H5> -
How to find the value of a variable in other program
How to find the value of a variable in other program say I am in a FM and this FM is being called in from other program and I want to know some of the variable details of the program from the FM itself. Imagine if this is a txn. and I need to know the details from some of the programs while executing the same transaction
Regards
VinHi Vinayak,
you will be having your first program values in internal table or some variables,
when you are calling the second program you wii use like this,
SUBMIT <Second Program Name> USING SELECTION-SCREEN '1000'
WITH s_emp(second program select-options) IN t_emp(first program variables)
WITH p_chk EQ t_chk
WITH p_r1 EQ t_r1
WITH p_month EQ t_month
WITH s_cust1 IN t_cust1
WITH p_r2 EQ t_r2
WITH s_cust2 IN t_cust2
WITH s_week IN t_week
AND RETURN.
you have pas like this to get your first program details. -
To display average value in a graph
Hi There,
In one graph I need to display the duration for each week as per the week range selected and a separate average duration value of the weeks selected.
Is it possible to develop a query for above average value and use this query in WAD?
Can anybody help in providing a solution
Thank you
AnimaBI Query data can be fed directly to WAD Charts.
See below.
http://help.sap.com/saphelp_nw04/helpdata/en/0c/95c83956852b51e10000000a114084/content.htm -
Too many decimals in Average value
Hi
I am using Report Builder and the wizard do design a table which i deploy as a .jsp page.
For some columns in the table I select to display the average values. Some of the values looks fine with one decimal as i want, but some values is displayed with a lot of decimals (about 10) as 164,346666666666666666. I have tried to change the length but without effect. Are there any possibility to decide the number of digits to be shown in the report . Or is i it a bug in Report Builder.Go to Property Inspector of the field and choose the right "Format Mask".
-
Creating function to calculate average value
Hi,
The below query was successfully return an average value. It returned 1 row.
SELECT AVG(Volume)
FROM security
WHERE
Type = 'Future' AND
Rating = 'AAA' AND
Code = 1 AND
(Day = ''14-mar-09' OR
Day = '16-mar-09' OR
Day = '');
I tried to use that function on my created function below.
CREATE OR REPLACE FUNCTION fn_Vol_Average
( v_DayLast_1_Week IN DATE,
v_DayLast_2_Week IN DATE,
v_DayLast_3_Week IN DATE )
RETURN NUMBER IS
v_Vol_Average NUMBER;
BEGIN
SELECT AVG(Volume) INTO v_Vol_Average
FROM security
WHERE
Type = 'Future' AND
Rating = 'AAA' AND
Code = 1 AND
(Day = v_DayLast_1_Week OR
Day = v_DayLast_2_Week OR
Day = v_DayLast_3_Week);
RETURN NVL(v_Vol_Average, NULL);
END;
I called that function by the following query. it was work, however it return the whole rows. It looks like the function perform the average calculation of each rows on the table.
Can anyone help me what is going on with the logic?
select fn_Vol_average('14-mar-09','16-mar-09','')
from security
--But since your function calculates the average over the whole security table, you wouldn't call this from a select statement which also reads the security table.
You just want to execute it once.
declare
l_vol_average number;
begin
l_vol_average := fn_Vol_average('14-mar-09','16-mar-09','');
dbms_output.put_line(l_vol_average);
end;By the way, be careful with your date parameters. You should use TO_DATE with a proper format mask to prevent conversion errors. -
How to find report values using report writer
hi,
Please help me.
How to find report values using report writer
Regards,
RRK.
Edited by: Alvaro Tejada Galindo on Feb 6, 2008 12:01 PMThanks all for the reply.
I am trying to solve a problem where report parameter value that is set at Management Console is wiped out after calling replaceConnection.
databaseController.replaceConnection(oldConnectionInfo, newConnectionInfo,
null,DBOptions._doNotVerifyDB);
We have to support changing database connection from a java utility
class. But once replaceConnection is called all existing static parameter values are lost. To fix this issue we thought of getting parameters and values before calling replaceConnection and setting it after replaceConnection.
Version is CS2008 SP3 - version 12.3.0.601
If there is any other option of fixing the original wipe out issue?
ParameterValues.getValues() didn't return value. I will try ParameterValues.getCurrentCalues() but the document says ParameterValues.getValues() is equivalent to the IParameterField.getCurrentValues() method unless it is empty, in which case it is equivalent to the IParameterField.getDefaultValues() method.
So getCurrentValues() may not work. -
How can i find the value category code in CJVC
Hi Gurus
how can i find the value category code in CJVC and which tables its stored.can any one tell me.please pleaseRead TPIK3 in an internal table, then search COEP-KSTAR in this table, with KSTAR between TPIK3-KSTRF and TPIK3-KSTRT, and other keys like Controlling Area and application/component (eg "PS" in project-system as in CJVC or "PM" in Maintenance as in IW33, multiple application use this table). You can also use a FM like PS_FIND_ACPOS_FOR_KSTAR.
Regards,
Raymond -
Display of "Average Values Text in ALV grid"
Hi
I use ALV grid to display the fields from a table. I have 15 columns. I need to do average for four columns.
In the field catalog i did a do_sum for those fields.
When the ALV grid is displayed I get average values for these columns.
Eg. Let suppose the grid looks like
Field1 Field2 Field3 Field4 Field5 Field 6.
vendor1 18 22 6 17 28
vendor1 54 11 16 62 28
vendor1 33 21 26 79 18
35 18 16 52 24
My requirement is I need to display the text "AVERAGE VALUES" . ( I need something like this.)
Field1 Field2 Field3 Field4 Field5 Field 6.
vendor1 18 22 6 17 28
vendor1 54 11 16 62 28
vendor1 33 21 26 79 18
Average values 35 18 16 52 24
Could someone help me in this?
Thanks & Regards
KavithaHello,
you can use event subtotal_text of ALV_GRID.
Regards,
Pedro Santos
Maybe you are looking for
-
Using multiple 'for' statements in an 11g pivot query
oracle: 11.2.0.3 Basically I need to pivot around 2 different columns (I think I need to 'for' clauses'). See below. Below is pseudo code from non-11g pivot statement. I am trying to figure out how to do with pivot. -- note field names are pseudo cod
-
Apple TV not working since new Time Capsule...Sync
I bought myself a new 1TB Time Capsule yesterday and set it up fairly easily. However, I notice now that I cannot sync my TV to my iMac anymore. It says: The Apple TV "Living Room Apple TV" is not repsonding. Check that any firewall software running
-
Hi All, we are getting below error message - "ORA-06550: line 9, column 20: PLS-00103: Encountered the symbol "IS" when expecting one of the following: := . ( @ % ; not null range default character ORA-06550: line 51, column 5: PLS-00103: Encountered
-
Flash Player spends more time crashed than running on my Firefox/Windows 7 PC. It has been suggesetd that I uninstall and reinstall it. Also the irritating little pop up asking to use space on my drive is now not responding. Any help resolving the
-
LotusXSL and WLS 5.1...
Is there anyone using the IBMs LotusXSL 1.0.1 package (Xalan.jar and Xeres.jar) with WLS 5.1 SP3? Because I can't make it work... Here's what I want to do my JSP: - Take XML stream - Take XSL stream (