Calculate Expression: Systime()
Hello,
I've a question regarding the systime() function in the expression module within MDM. As this whole feature is poorly documented and also has no real error / exception handling I would like to know what Input parameter is expected by this function.
The result is "quite" obvious: It returns the System time in the format YYYY:MM:DD:HH:MM:SS: MS.
As input parameters I've tried, e.g "YYYYMMDD" in various combinations just to try if I am able to change the output format. The funny thing is: the function expects an input parameter, but really takes everything as long as it is not empty: just put in "ABCD" and it's happy....
So: Anybody an idea on this function or general documentation on this?
The underlying problem is: I'd like to compare the Systime with a TimeStamp or a GMTime field. As this does not include hours, minutes and so on, it will just work if you're using the "bigger than" or "smaller than" operation, but not the "bigger than or equal to" etc...
Any experience on that is welcome!
Thanks,
Andreas
SYSTIME returns date and time in UTC/GMT format.
SYSTIME(day)
Day is a positive integer parameter, eg 1 for tomorrow;
0 for today
Ex:
(SYSTIME(0) - Creation Date) > 1
returns true if the record is older than 1 day
returns false if the record is not older than 1 day.
I agree with you the MDM Validation Functions are not documented at all. I wish SAP comes up with a good document with SP5.
Hope this helps.
Similar Messages
-
Dynamically how to calculate expression through PL/SQL ..?
My senario like...
I want to calculate the expression using array values from input parameter and then I want to send that calculated values as a output parameter.
How to do through PL/SQL..?
I am passing two parameter.
1. expression variable value as array,
2. expression as string
I want to execute that expression using Execute immediate or any other way through PL/SQL.
For Example,
exec myPL_SQLproc(p1,p2)
p1,p2 = (1,2,3), 'a*(a+10)-b+c'
p1,p2 = (1,2,3,4,5), '((a+b+c+d+e)+(a-b-c-d-e))*log(a)' here base10 for log(a).
here p1 is array (pl/sql table type)
p2 is string (expression: varchar2 type)Although I think this is likely to be a bad design decision, you can use something like:
DECLARE
TYPE values_tp IS VARRAY(10) OF NUMBER;
l_values_tp values_tp := values_tp(1,2,3);
l_expr VARCHAR2(25) := 'a*(a+10)-b+c';
l_exec VARCHAR2(25);
l_result NUMBER;
BEGIN
FOR i IN 1 .. l_values_tp.COUNT LOOP
l_expr := REPLACE(l_expr, CHR(96+i), l_values_tp(i));
END LOOP;
DBMS_OUTPUT.Put_Line(l_expr);
EXECUTE IMMEDIATE 'SELECT '||l_expr||' FROM dual' INTO l_result;
DBMS_OUTPUT.Put_Line('Result is '||l_result);
END;Minimally, you should check the formula string for things like semi-colons (;) and two consecutive hyphen (--) which could indicate a sql injection attempt. You would also probably need much more error handling.
TTFN
John -
Hi all,
Given this:
date
(rowgroup)
categories (colGroup)
Total (forCategories)
some Percent
Result
Result With%
Total of Result And Other Things here
cat1
cat2
cat3...
1st
[ val
val
val]
Sum(Value)
Max(%)
Tot*reportVar+3300
Result*1+Max(perc)
result + resultWith% (NOTE:this is total from last two cells)
2nd
3rd
Totals
Total
Total
total
total
rowGroup by date
colGroup by category
there are some "REPORT" variables that do things like "total" for a dataset that is to be shown on the report and used in some calcs...
So now that I've (hopefully) set the scene...
Aside from the apparent BUG in vs2012 where you can't see or get intellisense on "Group Level" variables - which is REALLY tough when you aren't that familiar with variables I must say!! - variables seem like they would solve my problem.
But if I use report variables in the row level I get the "cannot be used in aggregates" when I try to "Add Total" which is annoying but I'll accept that as a limitation, but surely this can't be the first time someone has wanted
to achieve the above in a report!!
So what is the solution, there must be one...
While I know SSRS is NOT Excel its really surprising and annoying when something so simple like summing the last two fields is nearly impossible and I can't see WHY it should be so frustrating that I have to have complex formula repeated in several
cells... particularly when I get the formula wrong and then have to remember to CHANGE it in several different places?!
Is SSRS simply not the right tool for reports where you need to be able to see and follow calculated series and I should be encouraging the business areas to extract data into Excel spreadsheets with some kind of template setup or am I missing something
really obvious about SSRS that would stop me from pulling all my hair out...?Hi noJedi,
If I understand correctly, you want to sum total values of the last three columns. In this situation, we can use custom code to work around the issue. Please refer to the custom code below to work around the issue:
Public Shared Value as Decimal=0
Public Shared Function GetValue(Item as Decimal) as Decimal
Value= value + Item
Return Item
End Function
Public Shared Function GetTotal()
Return value
End Function
Then use the expression below to calculate the multiplication result:
=Code.GetValue(Calculate Expression)
And use the following expression to calculate the sum value:
=Code.GetTotal()
Since you need to calculate three columns total values, we need modify the code repeat three times to get the values for each columns.
There is a similar issue, you can refer to it.
http://social.technet.microsoft.com/Forums/en-US/2084ef24-76d0-47c3-964a-340278d998c0/ssrs-2008-custom-code-to-properly-calculate-sums?forum=sqlreportingservices
If there are any misunderstanding, please feel free to let me know.
Regards,
Alisa Tang
If you have any feedback on our support, please click
here.
Alisa Tang
TechNet Community Support -
MDX syntax for current year in a Pre-defined condition
Hi,
I'm looking for assistance in building a Pre-defined condition in a universe based on an MSAS 2005 OLAP cube, that only returns the current year.
My year is defined as [Time Accounting].[Accounting].[Accounting Year]
I can create a Pre-defined filter that accepts a constant value as follows:
<FILTER KEY="[Time Accounting].[Accounting].[Accounting Year]">
<CONDITION OPERATORCONDITION="Equal">
<CONSTANT CAPTION="2008"/>
</CONDITION>
</FILTER>
and it works fine, however, I would like to make it dynamic.
There is an attribute called current year that is defined as [Time Accounting].[Accounting Year].[Accounting Year].[Current Year].[Value] but when I try and put this into my pre-defined filter nothing is returned:
<FILTER KEY="[Time Accounting].[Accounting].[Accounting Year]">
<CONDITION OPERATORCONDITION="Equal">
<CONSTANT CAPTION="[Time Accounting].[Accounting Year].[Accounting Year].[Current Year].[Value]"/>
</CONDITION>
</FILTER>
Is this possible? What am I doing wrong?
What I'm ultimately aiming for is a rolling 12 month condition.
Thanks,
ColinHi,
In OLAP universe, you cannot define a filter with CAPTION = another universe object.
What you can do is CAPTION = String or CAPTION = @Prompt.
By the way, if you want to achieve what you are requiring, I suggest you create a calculate expression such as:
<EXPRESSION>
IIF([Time Accounting].[Accounting Year.].CurrentMember.Properties("Name") = [Time Accounting].[Accounting Year.].CurrentMember.Properties("Current Year"), 1, 0)
</EXPRESSION>
Then you can define your filter on your new calculated expression and the operator to Equal and CAPTION = 1
Didier -
Could a 'money' or 'currency' primitive be added to the Java language specification? Something with 2 decimals places and proper rounding logic?
Anyone who has ever coded with BigDecimal or longs knows what I'm talking about. It's a major pain in the *ss and not doing the work leads to the stealthy rounding-error.
Operator overloading would work - since I could code my own class but I've found operator overloading to usually cause more unreadable code than it's worth.
I don't think name collision would be a problem since class names are defacto propercase.
What do you guys think?
Jason.way back while programming adventuregame I did a class which would calculate expressions... the variables were in hashtable and the class could be submitted with something like this "(characterposx+manposx)/2"... maybe you should create this kind of class... first you submit variables
definevar("aVar", 130*100+13); // should currency be defined as long with decimals being the %100 part?
calculate("aVar*aVar-aVar+100"); // sure this will take time to parse the expression
// and so on, but could be more easy and more
// adjustable. Maybe you could precompile it to an array of
// integers that represent bytecode kind of interface for
// this fast financical expression calculator...I think that this went well beyond the topic, but consider it. Might not be all bad. Might be worth effort even. -
I am trying to count the number of ID who complete a specific count of UNITS in a certain time frame
I want to count how many IDs have complete all 4 Units of each discipline. (see below for desire output)
Conditions
PERIOD: Has to be enrolled in any of the following PERIODS:1303/1313/1304/1314
ENROLL DATE: Has to be bigger then 01/AUG/2013
STATUS: Present
PATH_FLAG: Y
DAN_GR2 table links to DAN_GR1 TABLE by UNIT
(See below for logic)
{code}
CREATE TABLE DAN_GR2
(ID VARCHAR2(12),
UNIT VARCHAR2(12),
STATUS VARCHAR2(12),
PERIOD NUMBER (12),
ENROL_DATE VARCHAR2(12),
PATH_FLAG VARCHAR2 (12));
INSERT INTO DAN_GR2 (ID,UNIT,STATUS,PERIOD,ENROL_DATE,PATH_FLAG) VALUES ('1', 'LOG' ,'PRESENT', '1303' ,'05/SEP/13','Y');
INSERT INTO DAN_GR2 (ID,UNIT,STATUS,PERIOD,ENROL_DATE,PATH_FLAG) VALUES ('1', 'DLK' ,'PRESENT', '1313' ,'12/AUG/13','Y');
INSERT INTO DAN_GR2 (ID,UNIT,STATUS,PERIOD,ENROL_DATE,PATH_FLAG) VALUES ('1', 'FFF' ,'PRESENT', '1304' ,'12/AUG/13','Y');
INSERT INTO DAN_GR2 (ID,UNIT,STATUS,PERIOD,ENROL_DATE,PATH_FLAG) VALUES ('1', 'LOI' ,'PRESENT', '1302' ,'25/JUN/13','Y');
INSERT INTO DAN_GR2 (ID,UNIT,STATUS,PERIOD,ENROL_DATE,PATH_FLAG) VALUES ('1', 'BNR' ,'PRESENT', '1314' ,'01/OCT/13','Y');
INSERT INTO DAN_GR2 (ID,UNIT,STATUS,PERIOD,ENROL_DATE,PATH_FLAG) VALUES ('2', 'LOP' ,'PRESENT', '1304' ,'29/AUG/13','Y');
INSERT INTO DAN_GR2 (ID,UNIT,STATUS,PERIOD,ENROL_DATE,PATH_FLAG) VALUES ('2', 'DLL' ,'PRESENT', '1304' ,'29/AUG/13','Y');
INSERT INTO DAN_GR2 (ID,UNIT,STATUS,PERIOD,ENROL_DATE,PATH_FLAG) VALUES ('2', 'FUR' ,'PRESENT', '1314' ,'29/AUG/13','Y');
INSERT INTO DAN_GR2 (ID,UNIT,STATUS,PERIOD,ENROL_DATE,PATH_FLAG) VALUES ('3', 'PIL', 'PRESENT', '1303', '29/AUG/13','Y');
INSERT INTO DAN_GR2 (ID,UNIT,STATUS,PERIOD,ENROL_DATE,PATH_FLAG) VALUES ('3', 'POP', 'PRESENT', '1301', '01/JAN/13','Y');
INSERT INTO DAN_GR2 (ID,UNIT,STATUS,PERIOD,ENROL_DATE,PATH_FLAG) VALUES ('3', 'PKJ', 'PRESENT', '1303', '29/AUG/13','Y');
INSERT INTO DAN_GR2 (ID,UNIT,STATUS,PERIOD,ENROL_DATE,PATH_FLAG) VALUES ('3', 'PMN', 'PRESENT', '1303', '29/AUG/13','Y');
INSERT INTO DAN_GR2 (ID,UNIT,STATUS,PERIOD,ENROL_DATE,PATH_FLAG) VALUES ('4', 'BNR', 'PRESENT', '1314', '01/OCT/13','Y');
INSERT INTO DAN_GR2 (ID,UNIT,STATUS,PERIOD,ENROL_DATE,PATH_FLAG) VALUES ('4', 'LOG', 'PRESENT', '1304', '01/OCT/13','Y');
INSERT INTO DAN_GR2 (ID,UNIT,STATUS,PERIOD,ENROL_DATE,PATH_FLAG) VALUES ('4', 'DLK', 'PRESENT', '1304', '01/OCT/13','Y');
INSERT INTO DAN_GR2 (ID,UNIT,STATUS,PERIOD,ENROL_DATE,PATH_FLAG) VALUES ('4', 'FFF', 'PRESENT', '1314', '01/OCT/13','Y');
{code}
ID
UNIT
STATUS
PERIOD
ENROL_DATE
PATH
1
LOG
PRESENT
1303
05/SEP/13
Y
1
DLK
PRESENT
1313
12/AUG/13
Y
1
FFF
PRESENT
1304
12/AUG/13
Y
1
LOIJ
PRESENT
1302
25/JUN/13
Y
1
BNR
PRESENT
1314
01/OCT/13
Y
2
LOP
PRESENT
1304
29/AUG/13
Y
2
DLL
PRESENT
1304
29/AUG/13
Y
2
FUR
PRESENT
1314
29/AUG/13
Y
3
PIL
PRESENT
1303
29/AUG/13
Y
3
POP
PRESENT
1301
01/JAN/13
Y
3
PKJ
PRESENT
1303
29/AUG/13
Y
3
PMN
PRESENT
1303
29/AUG/13
Y
3
XCX
PRESENT
1303
29/AUG/13
Y
4
BNR
PRESENT
1314
01/OCT/13
Y
4
LOG
PRESENT
1304
01/OCT/13
Y
4
DLK
PRESENT
1304
01/OCT/13
Y
4
FFF
PRESENT
1314
01/OCT/13
Y
{code}
CREATE TABLE DAN_GR1
(UNIT VARCHAR2(12),
PATH VARCHAR2(12));
INSERT INTO DAN_GR1 (UNIT,PATH) VALUES ('LOG', 'TECH');
INSERT INTO DAN_GR1 (UNIT,PATH) VALUES ('DLK', 'TECH');
INSERT INTO DAN_GR1 (UNIT,PATH) VALUES ('FFF', 'TECH');
INSERT INTO DAN_GR1 (UNIT,PATH) VALUES ('BNR', 'TECH');
INSERT INTO DAN_GR1 (UNIT,PATH) VALUES ('LOP', 'SCIENCE');
INSERT INTO DAN_GR1 (UNIT,PATH) VALUES ('DLL', 'SCIENCE');
INSERT INTO DAN_GR1 (UNIT,PATH) VALUES ('FUR', 'SCIENCE');
INSERT INTO DAN_GR1 (UNIT,PATH) VALUES ('PIW', 'SCIENCE');
INSERT INTO DAN_GR1 (UNIT,PATH) VALUES ('PIL', 'LAW');
INSERT INTO DAN_GR1 (UNIT,PATH) VALUES ('POP', 'LAW');
INSERT INTO DAN_GR1 (UNIT,PATH) VALUES ('PKJ', 'LAW');
INSERT INTO DAN_GR1 (UNIT,PATH) VALUES ('PMN', 'LAW');
{code}
UNIT
PATH
LOG
TECH
DLK
TECH
FFF
TECH
BNR
TECH
LOP
SCIENCE
DLL
SCIENCE
FUR
SCIENCE
PIW
SCIENCE
PIL
LAW
POP
LAW
PKJ
LAW
PMN
LAW
WANT:
FINISHED ALL 4 UNITS
TECH
2
SCIENCE
0
LAW
0
ID 1 counts because it studied all the required units in DAN_GR1 in the given Periods.
ID 2 does not count because they only completed 3 units
ID 3 does not count. Even though they completed all the necessary units in DAN_GR1 one unit POP was taken before the required date and Period
ID 4 Count as they completed all the DAN_GR1 units in the given Date and Period.
(ideally if possible)
If possible i would like to count 4 units 3 units 2 units 1 unit and get an output like this
FINISHED ALL 4 UNITS
FINISHED ALL 3 UNITS
FINISHED ALL 2 UNITS
FINISHED ALL 1 UNITS
TECH
2
0
0
0
SCIENCE
0
1
0
0
LAW
0
1
0
0
i am assuming you have to use multiple sub query's within:
{code}
SELECT *
FROM DAN_GR1 A, DAN_GR2 B
WHERE A.UNIT = B.UNIT
AND B.STATUS = 'PRESENT'
AND B.ENROL_DATE > '01/AUG/2013'
AND B.PERIOD IN ('1303','1313','1304','1314')
AND B.PATH_FLAG = 'Y';
{code}
using: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64biThanks for including the create table and insert data scripts. It makes it a lot easier to help you.
You need to learn about GROUP BY and embedding one query inside another.
SELECT B.ID, A.PATH, count(*) units_finished
FROM DAN_GR1 A, DAN_GR2 B
WHERE A.UNIT = B.UNIT
AND B.STATUS = 'PRESENT'
AND B.ENROL_DATE > '01/AUG/2013'
AND B.PERIOD IN ('1303','1313','1304','1314')
AND B.PATH_FLAG = 'Y'
group by B.ID, A.PATH;
ID PATH UNITS_FINISHED
2 SCIENCE 3
3 LAW 3
4 TECH 4
1 TECH 4
That shows the two people who finished all 4 units.
Now for your basic requirement you need to add a HAVING clause that includes only the ID's that finished 4 units, and wrap it in an outer query to group by path and count the rows from the inner query.
E.g.
select dept, count(*)
from (
select emp.dept_id, emp.emp_id
from emp, sales
where emp.emp_id = sales.rep_id
group by emp.dept_id, emp.emp_id
having sum(sales) > 20000
group by dept
For your ideal one, leave out the HAVING clause that filters out ID's that didn't finish 4 units and calculate expressions like:
sum(case when units_finished = 3 then 1 else 0 end) finished_3_units
That should be enough hints to get you there.
Message was edited by: davidp2
Waited 2 hours, then Frank replied while I was working on my reply! -
Move used variables/strings
Dear all,
I try to use Dasylab to control and collect data from several equipments at lab (thermostat, stirrer, syringe pump, manostat, thermometer...). Now I have prepared several worksheets (each for single equipment) and it +- works (it is necessary to complete with some functionality but for collecting current lab data it is sufficient). The worksheets works, but only for single equipment, but I need to work with all of them. So I rebuild the worksheets that the each equipment is packed at black boxes (each worksheet one black box ant it works). Then I save all of black boxes and put them to one worksheet. Unfortunately, the worksheet prepared this way doesn’t work because there are problems with global string and variables. When I save the black box, I don't save the string/variables definitions. For instance the expression of one string in original worksheet is calculated automatically this way: "R" + SubStr( "000",1, 3-(${VAR_51}>=1000)-(${VAR_51}>=100)-(${VAR_51}>10)) + StrFmt(${VAR_51},8,0)+${STR_52} to prepare output string "R0120\r". I am able to export and import global string and variables but only as whole package of 999 variables. I don’t know how to move only used ones (I am able to move them at TXT format, but I am not able to read them to Dasilab as variables).
I have two questions:
1 - Is there any possibility to set "calculate expression automatically" for string/variable during running of program (using some action module or something like that)?
2 - Is there any possibility to save only used strings/variables and collected several packages of variables to one (for instance VAR_1-VAR_50 for thermostat and VAR_100-VAR_150 for thermometer)?I found that if I used the Define Global Variable dialog, and clicked the Save button, it gave me a choice of saving defined variables (those whose settings are not the default) or variable with descriptions.
I saved the file. It gave me a file that included all of the information.
I tried to use the Global Variables and Strings Import dialog, but the file was not ordered correctly.
I opened it in Excel and changed the columns around to match the Help (see picture). Then, I saved it as a TXT file again.
It imported with some errors - notably the additional settings, such as read at start, do not import. The one formula that I created imported correctly.
I think that you can save the used variables from your various worksheets, combine them into one file, change the order of the columns. Since it's a text file, you can change the variable numbers if you need to...
Unfortunately, you cannot import strings this way, as the Help says "DASYLab can only read in strings from VAR formats." Personally, I agree that this is a major limitation!
- cj
Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab. -
Hello, Expert,
Could you please help me with the following problem? Thanks in advance!
I have designed the matrix report (SSRS 2012) with database table structure looks like below.
Week
Version
Count
Week1
V1.1
4000
Week1
V1.2
4000
Week1
V1.3
4000
Week2
V1.1
3000
Week2
V1.2
3000
Week2
V1.3
3000
Week3
V1.1
2000
Week3
V1.2
2000
Week3
V1.3
2000
Week4
V1.1
1000
Week4
V1.2
1000
Week4
V1.3
1000
The matrix report displays like below. Column grows based on no of Week in the table.
Week1
Week2
Week3
Week4
V1.1
4000
3000
2000
1000
V1.2
4000
3000
2000
1000
V1.3
4000
3000
2000
1000
What I want to do now is: instead of the Count values, I need to calculate the percentage of each week over the
Count in Week1 so that each cell displays Count(Week2)/Count(Week1), Count(Week3)/Count(Week1), etc. What is the SSRS expression for that? I’m new to SSRS, Please help!Heidi,
Thank you so much for your reply and solution! Now I know how to get the first field in a group. But I can't apply your solution directly just yet because in order to explain my problem I simplified my data structure. My real data structure has a nested
group like this:
Week VersionMajor VersionMinor Count
Week1 V1 V1.1 2000
Week2 V1 V1.1 1500
Week3 V1 V1.1 800
Week1 V1 V1.2 1000
Week2 V1 V1.2 500
Week3 V1 V1.2 200
Week1 V1 V1.1 2000
Week2 V1 V1.1 1500
Week3 V1 V1.1 800
Week1 V1 V1.2 1000
Week2 V1 V1.2 500
Week3 V1 V1.2 200
Here is the query for the above data:
SELECT 'Week1' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 2000 AS Count
UNION ALL
SELECT 'Week2' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 1500 AS Count
UNION ALL
SELECT 'Week3' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 800 AS Count
UNION ALL
SELECT 'Week1' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 1000 AS Count
UNION ALL
SELECT 'Week2' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 500 AS Count
UNION ALL
SELECT 'Week3' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 200 AS Count
UNION ALL
SELECT 'Week1' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 2000 AS Count
UNION ALL
SELECT 'Week2' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 1500 AS Count
UNION ALL
SELECT 'Week3' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 800 AS Count
UNION ALL
SELECT 'Week1' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 1000 AS Count
UNION ALL
SELECT 'Week2' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 500 AS Count
UNION ALL
SELECT 'Week3' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 200 AS Count
And my matrix table looks like this:
What I need to do is to calculate the percentage of each week over week1 for
1) V1 Total
2) V1.1
3) V1.2
I can't use your solution directly because I need to apply Sum function for each cell and the Sum function gives me error when I try to use it on the denominator
First(Fields!Count.Value,"VersionMinor"). If you could help me further to get to the final solution, I'd really appreciate it!!
Happy New Year! -
Java program to calculate next execution time if one cron expression is giv
In my project requirement i wanted to have one function which will calculate next execution time using cron expression.
Here i have one cron expression which says every 25 minutes, i want to have one function which will be passed with cron expression and time and function should return next execution time.
I was wondering if any ready function available for the same.
Thanks in Advance[Did you check here?|http://www.lmgtfy.com/?q=java+cron+expression]
-
Hello,
I am using VS2010 shell. I have a matrix report where I have a row group by Year. Then I have a column group by Month.
When I run the report, I get 2013 data on top of 2014 data. Now I need to create a variance by year for each month.
So in the example below, I need to create an expression that will pull the variance for Oct 01... subtracting 2013 from 2014 for the months. So I need to Subtract 8,222 - 4290. I have no clue.
Here is what my rdl looks like.
Thank you for your help.Hi Adrian,
If I understand correctly, you want to calculate the difference order between 2013 and 2014 for every month. And there are only two years in the FISCAL_YEAR field.
If in this scenario, we can simply use the following expression to achieve your requirement:
=first(Fields!ORDER.Value)-last(Fields!ORDER.Value)
The following screenshot is for your reference:
If there are any misunderstanding, please elaborate the issue for further investigation.
Regards,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Hi Everyone!
Project Background:
I've been working with the myRIO FPGA in an attempt to generate an application capable of sampling a tri-axis accelerometer and performing an fft on each axis. I've successfully developed an application for a single axis, but attempting to duplicate the code to sample the second and third axes in parallel results in an estimated 150% resource utilization for the tiny FPGA's LUT's. Additionally, I'm looking to avoid sequentially processing each accelerometer input using triggers and a single fft block because that reduces my fft update frequency significantly (e.g. I can't calculate another fft for input 1 until I calculate an fft for inputs 2 and 3).
After reading up on the fft vi, I'm thinking that I can use the M-interval input indexes / Continuous output indexes Input/Output Index Pattern mode. My thought is that I can edit the vi to remove any math that "recombines" these three vectors into a single fft, resulting in 3 separate fft's. I'm also hoping that this process requires less time than using the sequential method described above.
The Questions:
1. Has anyone done an fft on three inputs using the myRIO at sampling rates > 20kHz and fft sizes of 1024 or larger? If so, I may just be lacking some proper resource management.
2. Does anyone know where to find timing information on the M-interval input indexes / Continuous output indexes Input/Output Index Pattern mode? The manual only provides timing diagrams for singel channel / single input modes. I don't want to waste my time modifying the vi if it will still take 3x as long (assuming modifying the vi is even a possibility).
Further Information:
I already have an application written that samples the accelerometers at >20kHz and then performs the fft on the main processor, but now I'm looking to see if it is possible to perform all signal processing on the FPGA side. The processor performs decently enough, but the timing is not as consistent as I would like it to be. Lastly, I am aware that the myRIO itself has a built in accelerometer, but I need to mount the accelerometer in an environment where the myRIO would probably be damaged and definitely cannot fit.
Any thoughts are much appreciated! The excessive FPGA compile times for this thing make the old guess and check method less appealing.
-ChrisHi Chris,
Thanks for posting and the detailed background on the project! To answer some of your questions:
1. The FFT Express VI does use a significant amount of space. The FPGA on the myRIO is somewhat limited space-wise. Your best option may to implement the FFT for 1 channel on the FPGA and the other two on the RT side.
2. I converted the FFT Express VI to a subVI and I am not sure if you can trim too much code from it. The subVI is also very complex so re-working it would be a significant amount of work. I could not find much documentation on M-interval input indexes / Continuous output indexes Input/Output Index Pattern mode timing.
I hope that this helps!
Thanks,
Frank
Application Engineer
National Instruments -
Java expression - hot express ArrayIndexOutOfBounds in If Statement
Hi !
I would like to know how I can express the following correctly:
Testcode - just to show what i mean:
int[][] testArray = whatever assignments here
if (testArray[line][row] != ArrayIndexOutOfBoundsException)
.... do stuff here...
}As obvious I basically just wanna add numbers across this twodimentional array - in rows - not lines !.
And as some lines and rows can be shorter than others, eventually Ill end up with an OutOfBoundsException.
So how can I handle those inside the if statement ? What is the correct expression to avoid those?
As the current expression doesent work.
As obviously those slots are NOT null but literally non existent slots, that must be checked for before adding the int inside.
Thanks for help !"sort on the array" ?
yeah actually where can I look up the methods for arrays ?
anyway, I left it a bit and eventually came back to it:
Now I have it fixed to calculate the columns for any 2D array
Cheers for the good comments though !
zeile = line
spalte = column
int spaltenMax = 0;
for (int zeile = 0; zeile < data.length; zeile++)
if (spaltenMax < data[zeile].length)
spaltenMax = data[zeile].length;
System.out.println("There are " + spaltenMax +" columns" );
for (int spalte = 0; spalte < spaltenMax; spalte++)
for (int zeile = 0; zeile < data.length; zeile++)
int zeilenL = data[zeile].length;
if (zeilenL-1 >= spalte)
rowSum += data[zeile][spalte];
System.out.println("For column " +(spalte+1) + " the sum is: " +rowSum );
rowSum = 0;
-
SSRS Cascading Parameter Setting Default Value of Parameter by Expression
Hi All,
I need some help on an issue I am running into in SQL server 2008 report parameters. I have the following Report Parameters defined:
1) @PredefinedDateSelection - Boolean (User Selectable True/False, Default Value - 'False')
2) @StartDate - Text (User input text box)
If @PredefinedDateSelection = TRUE, then I would like to provide a particular default value to the StartDate textbox (i.e. @StartDate Default Value), If @PredefinedDateSelection = FALSE, then I would like to provide a different default value.
I have the following code for the Expression for the Default value of @StartDate: =code.GetStartDate(Parameters!PreDefinedTimeSelection.Value)
where GetStartDate is a very simple VB function defined as :
Public Function GetStartDate(x as boolean ) As String
Dim a as string
Dim b as string
a = "Report Uses Predefined Values"
b = "Please Input Value"
If (x) then
Return a
else
Return b
end if
end function.
Now the default value of @StartDate stays set as "Please Input Value", and does not change when I toggle @PredefinedDateSelection from False to True and vice versa. I was expecting to see the Default value to change between the two messages depending on my selection in the report preview.
Another parameter which is a dropdown and uses a dataset to display two different set of selectable items depending on the value of @PredefinedDateSelection is working just fine. I am not sure if I am missing something or I am doing something wrong.
Instead of using the VB code I also tried : =iif(Parameters!PreDefinedTimeSelection.Value = True,"Report Uses Predefined Values","Please Input Value")
I also tried changing the default value using a dataset with SQL query and the available value set to NONE, so that the user could input. But the Default value does not refresh or change values.
I hope I have explained my question clearly. I would really appreciate any thoughts and comments.
Thanks,
AruneshThank you much for your response.
I tried that and it did work. But my requirement is to have a user input the date. The basic idea is if the user decides on a predefined time range like Day Shift Today or Yesterday and so on... then the report would automatically calculate the values based on predefined date time values. On the other hand, if the intent is to run the report for an arbitrary period then the user supplies the date and time limits.
What I am trying to achieve is have the same parameter available for user input , but when the User decides he wants Predefined then the "textbox" populates with date and time as per his choice of predefind range.
I understand that by this the user can still overwrite the date and time on the text box, but the report will run the predefined values as long as he has the @PredefinedDateSelection Set to true.
Is there a way I can impement this?
Once again I thank you and appreciate your input. -
How to calculate the Percent change in a dynamic
hi All,
I'm trying to get the percent increase/change of two dynamic
colums. In my report, the user has a checkbox where he can select two colums to calculate the percent growth.
My DataSet is PilarName, Calification(is a decimal value) and Period (this is a string). I created the Matrix this way:
PilarName [Period]
[PilarName] [Calification]
Which give me these values:
So, now I need to create another column to calculate the percentage change between these two colums. I tried this:
I added a Adjacent column group for Period column and I grouped by the calculated column "ColumnDiff". Add the following expression.
=(SUM(Fields!Calificacion.Value)- Previous(SUM(Fields!Calificacion.Value),"ColumnDiff"))/Previous(SUM(Fields!Calificacion.Value),"ColumnDiff")
After that I get:
I'm getting the sum of the two columns instead.
Any clue about what I'm doing wrong? Please help me, I've been looking for the answer but any solution works for me.
Luis CarlosHi Luis,
According to your description, you have a report with different dynamic columns. Now what you want is show your user percentage growth in your matrix report after your user select two of those columns (I think you may use parameter to achieve your “checkbox”
function). Is my understanding correct?
In Reporting Service, we can’t calculate dynamic columns with our build-in arrogation functions. So we need to add custom code into our report, and call those functions which defined in custom code in our expression. We have tested your scenario in our local
environment. Here are steps and screenshots for your reference.
Go to your Report Properties, add the custom code below into your report:
Dim Shared Num1 As Double
Dim shared Num2 As Double
Public Function GetCalification(Calification as Double,Type as String,Type2 as String)
If Type = Type2 Then
Num1=Calification
Else
Num2=Calification
End If
Return Calification
End Function
Public Function GetPec()
Return (Num2-Num1)/Num1
End function
Create a matrix. Put PilarName into Row field, put Period into Column field. In Data field, put the expression below into the textbox:
=Code.GetCalification(Fields!Calification.Value,Fields!Period.Value,Parameters!Period.Value(0))
In our sample report, we created a parameter (named Period) for selecting two columns. You can replace “Parameters!Period.Value(0)” with your own parameter.
Add an outside column at right (%Growth), put the expression below into the textbox:
=Code.GetPec()
Save and preview. The matrix and result looks like below:
Reference:
Custom Code and Assembly References in Expressions in Report Designer (SSRS)
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
MDX Calculate minimum price at a higher level of granularity
Hi all!
I can't find my way to calculate the following scenario in SSRS mdx statement: I need to know the "category best price" of a product category at a lower level of granularity. See example below:
Category: Subcategory: Price:
Category Best Price?
Adventure Bikes 110 105
Adventure Kayak 120 105
Adventure Running Coat 105 105
Fitness Training Shoes 80 75
Fitness T-Shirt 75 75
I need to undestand how can I build the Calculated Measure to get the "category best price" column! Note that in the real scenario, there are much more values in the rows, so the granularity is much higher. Additionally, the attributes doesn't
belong to the same dimension.
Thanks a ton for your help!Hi mts_aa,
According to your description, you want to show lowest price of each Category group in each row. Right?
In this scenario, we can generate this column in MDX query level. Please refer the query below:
with member [Measures].[MinChildren]
as
min([Product].[Product Categories].currentmember.parent.children,[Measures].[Price])
select {[Measures].[Price],[Measures].[MinChildren]} on 0,
[Product].[Category].[Category].members*[Product].[Subcategory].[Subcategory].members on 1
from
[MDX]
Also you can do this on report level. You just need to have the records group on Category. Then use the expression below in detail row:
=Min(Fields!Price.Value,"Category")
Reference:
Understanding Groups (Report Builder and SSRS)
If you have any question, please feel free to ask.
Best Regards,
Simon Hou
Maybe you are looking for
-
Help with SWFObject2, problem with display of alternate image
I'm trying to use SWFObject2 dynamic publishing version to test the visitors browser for flash pluggin and the version. I want to only show my flash image if the browser finds the flash plug in and it supports the correct version of flash for my bann
-
How can I update my IPad when there is no item for it on the menu of my ipad
I cannot find a way to up date my iPad because there isn't an item on the menu for it. No one seems to be able to get round this my iPad model is MC 769B and is only 14MB but surely I should be able to update to an iOS 5 or 6?
-
Strange Problem on my 17" Studio Display
Ok, just to get the specs out of the way - 2 17" Apple Studio Displays, both connected with ADC to DVI adapters to a Dual Core 2.3 PowerMac G5, running OSX 10.4.7, 2.5 GB RAM. Saturday night we had a VERY bad storm - my wife and I were out when it hi
-
Cannot find the device software to upgrade my BB 8310?
Hello all, I am in Paris France and own a BB curve 8310. I would like uo upgrade the sofware on my BB but cant find it anywhere.... I went there http://na.blackberry.com/eng/support/downloads/download_sites.jsp, but only 2 French providers are listed
-
Greetings, I am fairly new to Dreamweaver and need help with embedding an mp4 file directly into the html page. I am using the design mode in dreamweaver and have attempted to just drag and drop the file from its location on my computer into the Drea