Week 2 - calculation of pressure BMP180
Hi people,
It's still bugging me, I had the temp calc works very well. But my pressure barometric calc is not fair. Values are output, and he reads maybe 20-30 seconds and then hangs. So I guess I'm hanging songs too much in a way or another.
My code looks like this:
Read 0xF6 (MSB) and 0xF7 (LSB), and 0xF8 (XLSB) | |
short-MSB = bmp180.pull (0xF6); Read the first 8 bits | |
short LSB = bmp180.pull (0xF7); Read 8-bit seoncd | |
short XLSB = bmp180.pull (0xF8); Read the third 8-bit |
rawPressue long = (MSB < < 16 + LSB < < 8 + XLSB) > > (8 - OSS); |
Calculate | |
long X 1, X 2, X 3, ActualPressure; | |
Long B6 = C - 4000; | |
X 1 = (VB2 * (B6 * B6 > > 12)) > > 11. | |
X 2 = AC2 * B6 > > 11. | |
X 3 = X 1 + X 2; | |
B3 long = (((AC1 * 4 + X3) < < OSS) + 2) / 4; | |
X 1 = AC3 * B6 > > 13. | |
X 2 = (VB1 * (B6 * B6 > > 12)) > > 16; | |
X 3 = ((X 1 + X2) + 2) > > 2; | |
long B4 = AC4 * (X 3 + 32768) > > 15; | |
Long B7 = (rawPressue - B3) * (50000 > > OSS); | |
If (B7 < 0 x 80000000) {} | |
ActualPressure = (B7 * 2) / B4; | |
} else {} | |
ActualPressure = (B7/B4) * 2; | |
} | |
X 1 = (ActualPressure > > 8) * (ActualPressure > > 8); | |
X 1 = (x 1 * 3038) > > 16; | |
X 2 = (-7357 * ActualPressure) > > 16; | |
ActualPressure = ActualPressure + (X 1 + X 2 + 3791) > > 4; |
Someone did this work?
I am interested to then calculate the Altitude and compare GPS reading or be able to supplement the GPS data if you do not find enough satellites for a 3D signal.
I hear the solution for this work at home is available from lesson 2, I suggest you just take a peek.
Tags: Java
Similar Questions
-
Psychrometric charts using in Labview to calculate moisture?
I built a hygrometer to mirror cooled for a school project and all control through labview. I'll have the dew point and the temperature of the dry dry bulb that I need to calculate the rate of moisture through an algorithm or a look up table psychrometric charts. can anyone help please.
The necessary equations to calculate the relative humidity of pressure and dry and wet bulb temperature can be found here:
http://www.SRH.NOAA.gov/ELP/wxcalc/formulas/rhTdFromWetBulb.html
With both temperatures and pressure to come as long as variables, I would break just calculating what they have on the Web page linked, by first calculating the pressure of saturated steam and wet bulb ==> and then calculate the actual vapour pressure ==> then the relative humidity. All operators you need for these calculations must be under the function of mathematical operators range. You could call all individual operations, including the exponentials, or just use a few knots of formula.
Of course, just dump everything in a while loop (with a delay), to make the system constantly monitor and update the moisture. -
Help with real pressure for BMP180 algorithm
The algorithm provided by the BMP180 data sheet contains some features that ME8 can't stand not (Math.pow (), unsigned long, etc.). I tried the best I can reproduce it, is that correct?
My code:
long B6 = B5 - 4000; long X1 = (B2 * (B6 * B6 / (1L << 12) )) / (1L<<11); long X2 = AC2 * B6 / (1L<<11); long X3 = X1+X2; long B3 = (((AC1 * 4 + X3)<<OSS)+2)/4; X1 = AC3 * B6 / (1L<<13); X2 = (B1 * (B6 * B6 * (1L<<12)))/(1L<<16); X3 = ((X1 + X2)+2)/4; long B4 = AC4 * Math.abs(X3+32768) / (1L << 15); long B7 = Math.abs(UP-B3) * (50000 >> OSS); long p; if(B7<0x80000000) { p = (B7*2) / B4; } else { p = (B7/B4) * 2; } X1 = (p/(1L << 8)) * (p/(1L << 8)); X1 = (X1 * 3038)/(1L << 16); X2 = (-7357 * p)/(1L << 16); p = p + (X1 + X2 + 3791) / (1L << 4);
I don't seem to be able to display an image, but the Bosch code is in the BMP180 data sheet page 15, under the heading "Calculate real pressure"
Hi Luke,.
Well, your calculation code must be correct, so I think that the problem is with this line:
UP = (data [0]<16 +="">16><8 +="" data[2])="">>(8-OSS);)
try instead:
UP = (((data [0] < 16)="" &="" 0xff0000)="" +="" ((data[1]=""> < 8)="" &="" 0xff00)="" +="" (data[2]="" &="" 0xff))=""> > (8-oss);))
Reason: your MSB is negative, to hide the added bits when byte gets promoted to int.
To see why, play with this:
class {shift
Public Shared Sub main (String [] args) {}
n bytes = Byte.valueOf(args[0]);
System.out.println (n);
System.out.println (n<>
System.out.println ((n<>
}
}
$ java - cp. SHIFT 1
1
65536
65536
$ java - cp. Shift - 89
-89
-5832704
10944512
Kind regards
Colin
8> -
Perfect calculation App of the week (any activity) is incorrect
I focused on using three ring activity App from Apple daily. Since 17 October, I haven't missed a day that would amount to 31 weeks to get my circles. A screenshot of the application indicate, however, that I did this 57 weeks in a row. So, I bought the watch September 24, 2015 (according to the fitness App in shape since it is the first day of the rings), which is only 35 weeks. I don't really have an answer, but Apple might want to check how it is calculated. Greg
greg263 wrote:
... I don't really have an answer, but Apple might want to check how it is calculated. Greg
Hi Greg
It is a community based on the user.
If you want to inform Apple on your question, you can do here (which may be a link to your post and the screenshot):
-
bi weekly loan using the HP 10bII calculator payments +.
Hello
Can someone explain to me please how to calculate bi weekly loan using the HP 10bII calculator payments +.
Here is an example from real life:
5.49% annual interest rate,
loan of $35420,33,
6 years,
the payment should be $266,74,
but I don't know how to do this.
Thanks for your help.
Andrew
Hello
Weekly payments = 26 paid annually.
26 the value paid per year:
26 OrangeShift P/YR (on PMT key)
Now enter data & colon;
5.49 press I / YR
-PV-press 35420.33
26 * 6 = press N (26 payments per year * 6 years, the result, 156 will be stored n)
0 press FV (just to be sure that FV is set to 0)
Now press on PMT and it will show 266,74
Don't forget P/YR will remain at 26 until you enter a new value or reset the calculator (clear all does not reset it, but will remind you the current value).
HTH
-
I noticed that, thanks to the I2CCombinedMessage it is possible to support the multi-master configurations, as a combined message is treated as a transaction, a single bus, where a rather lengthy communication with a slave i2c (as request of get-temp - pressure and designed by BOSCH for the BMP180 complex) is protected from interference by other masters of the bus. Great!
But looking at fact sheet BMP180 of BOSCH, it turns out the I2CCombinedMessage is not a suitable driver for this particular problem, because the appliance rather lenthy delay between the command and reading - and the JavaDocs of the I2CCombinedMessage does not help on adding breaks in the recorded transaction.
Therefore, it would be great if I2CCombinedMessage would have a .pause(long milliseconds) method.
Is there something like that planned for a future release, or I have to go with the methods begin() and end() distinct (which is of course a workaround)?
Hi Marcus!
No,. pause() isn't in the plan for the near future. And Yes, begin () /end () workaround
/ Sergey
-
Weekly, fortnightly / monthly box calculation
Hi people,
I am designing a form and the customer asked for some calculations of output according to what a "weekly", "Fortnight" or "Monthly" checkbox is checked.
I tried looking for the answer, but am completely confused.
There are 3 areas on the form where this charge weekly or fortnightly/monthly calculation is necessary:
Area 1.
In the light of the foregoing, a box should be checked and the hours Minimum and the hourly rate is entered. It will then calculate annual income.
The box should apply to these modifiers of multiplication: x 52 weekly, biweekly 26 x and x 12 monthly
So, if someone has done 20 hours a week at the hourly rate of $15, the calculation of annual income would be: 52 x 20 x 15 = $15 600
Area 2.
In the light of the foregoing, a value of $ for the caregiver is entered, and then a checked checkbox. This will then provide a calculation of annual income.
The box should apply to these modifiers of multiplication: x 52 weekly, biweekly 26 x and x 12 monthly
So if anyone has had the help of the family $ 650 on a weekly basis, the calculation would be: $650 x 52 = $33 800
Area 3.
In the light of the foregoing, a value of $ for rental income is entered, and then a checked checkbox. This will then give you the calculation of annual rental income.
The box should apply to these modifiers of multiplication: x 52 weekly, bimonthly x 26 x 12 monthly and each year x 1
So if anyone had rental income from $500 on a fortnightly basis, the calculation would be: $26,500 x = $13 000.
If someone would be kind enough to help out, that would be much appreciated
Thank you
All the boxes have a value to export (under Properties - Options). Set the values that you want to use in your calculations as the value of exports of these boxes (so, for the '52' weekly, fortnightly '26', and each '1' year) and then you will be able to use them directly in the first option on the calculation of your text fields tab: value is (product) of... Then select the fields in the list.
-
calculation of the week and the month of the column date
I have 3 data as column
I need to convert it to 4 columnswith tab as ( select 'Topshop' brand, '10-JUL-11' deliverydate, '100' qty from dual union all select 'Topshop' brand, '10-JUL-11' deliverydate, '400' qty from dual union all select 'NewSita' brand, '11-JUL-11' deliverydate, '200' qty from dual union all select 'LaGress' brand, '12-JUL-11' deliverydate, '300' qty from dual union all select 'LaGress' brand, '10-AUG-11' deliverydate, '100' qty from dual union all select 'LaGress' brand, '11-AUG-11' deliverydate, '200' qty from dual union all select 'Topshop' brand, '12-AUG-11' deliverydate, '300' qty from dual union all select 'NewSita' brand, '10-SEP-11' deliverydate, '100' qty from dual union all select 'Topshop' brand, '11-SEP-11' deliverydate, '200' qty from dual union all select 'NewSita' brand, '12-SEP-11' deliverydate, '300' qty from dual ) select * from tab
Brand | Month | Week (start date). Amount (sum)
Please let me know what are the options I have, in particular the calculation of date and time functions available to solve these problems.
Thank you
w\Check this box
with tab as
(
Select the option 'Topshop' brand, July 10, 11 'deliverydate, ' 100' qty of any union double
Select the option 'Topshop' brand, July 10, 11 'deliverydate, ' 400' qty of any union double
Select the option "NewSita" brand, 11 July 11 'deliverydate, ' 200' qty of any union double
Select "brand the LaGress, 12 July 11' deliverydate, '300' qty of union double all the»
Select "brand the LaGress, 10 Aug 11' deliverydate, '100' qty of union double all the»
Select "brand the LaGress, 11 Aug 11' deliverydate, '200' qty of union double all the»
Select the option 'Topshop' brand, 12 Aug 11 'deliverydate, ' 300' qty of any union double
Select the brand 'NewSita',' 10-SEP-11 deliverydate, '100' qty of all double union
Select the option 'Topshop' brand,' 11-SEP-11 deliverydate, '200' qty of any union double
Select the option "NewSita" brand, deliverydate, '300' qty of the double' 12-SEPT-11
) select the brand, deliverydate, NEXT_DAY (to_date (deliverydate, 'DD-MON-yy'), "LUN")-7, Qty tab. -
Perform calculations between the weeks and categories
Given this example, if I calculate the difference between each week the intention and filing to show in the lines of the plan again and again filing?
For example, the value displayed in Col: Y3W3 line #4 deposit must be the result of line Y3W3 2 - Row 2 Y3W2. Digitally: 111 minus 100 = 11.Row# SEM STUDENT_LEVEL COLLEGE PROGRAM STATUS Y3W2 Y3W3 Y3W4 Y3W5 Y3W6 1 40 GR BN BMA-SJ 14.Intend 132 132 137 139 139 2 40 GR BN BMA-SJ 17.Deposit 100 111 115 114 117 3 40 GR BN BMA-SJ 20.New Intend 0 0 0 0 0 4 40 GR BN BMA-SJ 21.New Deposit 0 0 0 0 0
Tier 4 after that calculation should look like:
If the change is negative, then we would show 0.4 40 GR BN BMA-SJ 21.New Deposit 1 11 4 0 3
There are also some Calc percentage within the week and the categories and between weeks and years, but if understand us this, we can hope that use to others, so we won't post the part yet.
Here's the query portion and sampling data. The sample data are summarized from the level of detail:WITH ADMLIST AS ( SELECT 1 AS WEEKNO, 2009 AS YEAR, 40 AS SEM, 'GR' AS STUDENT_LEVEL, 'BN' AS COLLEGE, 'BMA-SJ' AS PROGRAM, '14.Intend' AS STATUS, 139 AS TOT FROM DUAL UNION ALL SELECT 1 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '17.Deposit', 94 FROM DUAL UNION ALL SELECT 1 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '20.New Intend', 0 FROM DUAL UNION ALL SELECT 1 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '21.New Deposit', 0 FROM DUAL UNION ALL SELECT 2 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '14.Intend', 132 FROM DUAL UNION ALL SELECT 2 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '17.Deposit', 100 FROM DUAL UNION ALL SELECT 2 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '20.New Intend', 0 FROM DUAL UNION ALL SELECT 2 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '21.New Deposit', 0 FROM DUAL UNION ALL SELECT 3 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '14.Intend', 132 FROM DUAL UNION ALL SELECT 3 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '17.Deposit', 111 FROM DUAL UNION ALL SELECT 3 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '20.New Intend', 0 FROM DUAL UNION ALL SELECT 3 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '21.New Deposit', 0 FROM DUAL UNION ALL SELECT 4 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '14.Intend', 137 FROM DUAL UNION ALL SELECT 4 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '17.Deposit', 115 FROM DUAL UNION ALL SELECT 4 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '20.New Intend', 0 FROM DUAL UNION ALL SELECT 4 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '21.New Deposit', 0 FROM DUAL UNION ALL SELECT 5 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '14.Intend', 139 FROM DUAL UNION ALL SELECT 5 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '17.Deposit', 114 FROM DUAL UNION ALL SELECT 5 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '20.New Intend', 0 FROM DUAL UNION ALL SELECT 5 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '21.New Deposit', 0 FROM DUAL UNION ALL SELECT 6 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '14.Intend', 139 FROM DUAL UNION ALL SELECT 6 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '17.Deposit', 117 FROM DUAL UNION ALL SELECT 6 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '20.New Intend', 0 FROM DUAL UNION ALL SELECT 6 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '21.New Deposit', 0 FROM DUAL ) SELECT sem, student_level, college, program, status, -- max(CASE WHEN WEEKNO=2 AND YEAR=2007 THEN TOT END) AS Y1W2, -- max(CASE WHEN WEEKNO=3 AND YEAR=2007 THEN TOT END) AS Y1W3, -- max(CASE WHEN WEEKNO=4 AND YEAR=2007 THEN TOT END) AS Y1W4, -- max(CASE WHEN WEEKNO=5 AND YEAR=2007 THEN TOT END) AS Y1W5, -- max(CASE WHEN WEEKNO=6 AND YEAR=2007 THEN TOT END) AS Y1W6, -- max(CASE WHEN WEEKNO=2 AND YEAR=2008 THEN TOT END) AS Y2W2, -- max(CASE WHEN WEEKNO=3 AND YEAR=2008 THEN TOT END) AS Y2W3, -- max(CASE WHEN WEEKNO=4 AND YEAR=2008 THEN TOT END) AS Y2W4, -- max(CASE WHEN WEEKNO=5 AND YEAR=2008 THEN TOT END) AS Y2W5, -- max(CASE WHEN WEEKNO=6 AND YEAR=2008 THEN TOT END) AS Y2W6, max(CASE WHEN WEEKNO=2 AND YEAR=2009 THEN TOT END) AS Y3W2, max(CASE WHEN WEEKNO=3 AND YEAR=2009 THEN TOT END) AS Y3W3, max(CASE WHEN WEEKNO=4 AND YEAR=2009 THEN TOT END) AS Y3W4, max(CASE WHEN WEEKNO=5 AND YEAR=2009 THEN TOT END) AS Y3W5, max(CASE WHEN WEEKNO=6 AND YEAR=2009 THEN TOT END) AS Y3W6 FROM ADMLIST GROUP BY sem, student_level, college, program, status ORDER BY 5;
Hello
You can get the difference from one week to the next (or 0) using the analytical LAG function, like this:
GREATEST ( tot - LAG (tot) OVER ( PARTITION BY status -- and maybe other columns, like sem, student_level, ..., too ORDER BY year , weekno ) , 0 ) AS dif
Corresponds to the data you posted really what is in your tables, or is it the result of an earlier stage?
If it's really in your tables, and then instead of select of your tables, select in a UNION of
(a) your table except the lines where status = '21.New' file
(b) your table, once again, with status ='21.New deposit "and the numbers of dif (as shown above) in the column tot.If the data you posted is a partially digested form of your RAW files, then dif can probably be incorporated into the digestion process.
In any case, calculate dif until you rotate the data.
-
Calculated for absent complex the day of the week
I need to find the number of days absent per employee according to the following criteria. I'll explain using test table as below.
the table below contains the data for each employee per day in the pt_hrs column, if the hours = 0 means that it is not present for that particular day. Friday is a weekend for us.
case 1,
Normal case since it is present every day except Friday, there are no missing for him.
Case 2,
If the employee is absent from Thursday and he reported to duty Saturday, then Friday is considered to be absent.
Case 3,
If the employee comes back from vacation let tell it the spokesperson of service directly on Saturday, and then Friday is considered to be absent.
Case 4
If the employee is absent from Thursday and he reported to duty Sunday, then Friday is considered to be absent.
[code]
CREATE TABLE PT_ATTENDANCE_REG (PT_EMP_CODE VARCHAR2 (12), PT_DATE DATE, NUMBER OF PT_HRS);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R001', TO_DATE('24/11/2015'), 8);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R001', TO_DATE('25/11/2015'), 7);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R001', TO_DATE('26/11/2015'), 8);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R001', TO_DATE('27/11/2015'), 0);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R001', TO_DATE('28/11/2015'), 8);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R001', TO_DATE('29/11/2015'), 8);
-case 2
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R002', TO_DATE('24/11/2015'), 8);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R002', TO_DATE('25/11/2015'), 7);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R002', TO_DATE('26/11/2015'), 0);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R002', TO_DATE('27/11/2015'), 0);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R002', TO_DATE('28/11/2015'), 8);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R002', TO_DATE('29/11/2015'), 8);
-case3
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R003', TO_DATE('24/11/2015'), 0);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R003', TO_DATE('25/11/2015'), 0);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R003', TO_DATE('26/11/2015'), 0);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R003', TO_DATE('27/11/2015'), 0);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R003', TO_DATE('28/11/2015'), 8);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R003', TO_DATE('29/11/2015'), 8);
-CASE4
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R004', TO_DATE('24/11/2015'), 8);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R004', TO_DATE('25/11/2015'), 7);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R004', TO_DATE('26/11/2015'), 0);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R004', TO_DATE('27/11/2015'), 0);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R004', TO_DATE('28/11/2015'), 0);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R004', TO_DATE('29/11/2015'), 8);
-desired output will be as follows - R001 is not included because he was away for the weekend only.
PT_EMP_CODE, NO_OF_DAYS_ABSENT
'R002' 2
'R003' 4
'R004' 3
[/ code]
Hello
Arif75 wrote:
...
CREATE TABLE PT_ATTENDANCE_REG (PT_EMP_CODE VARCHAR2 (12), PT_DATE DATE, NUMBER OF PT_HRS);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R001', TO_DATE('24/11/2015'), 8);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R001', TO_DATE('25/11/2015'), 7);
,,,
Thanks for posting of sample data, but always use 2 arguments when calling TO_DATE. The TO_DATE call with 1 single argument has all the problems of an implicit conversion.
Thus, a person is considered on Friday that if he was absent the day before or the day after, isn't it?
Here's a way to do it:
WITH got_absent AS
(
SELECT pt_emp_code
pt_date - necessary only for date filtering
CASE
WHEN pt_hrs > 0
THEN 0
WHEN TO_CHAR (pt_date
, "DY".
'NLS_DATE_LANGUAGE = ENGLISH'
) <> 'FRI'
THEN 1
HOW much MONEY (SIGN (pt_hrs)) OVER (PARTITION BY pt_emp_code
ORDER BY pt_date
BETWEEN 1 PRECEDING
AND 1 SUITE
)<>
THEN 1
0 OTHERWISE
END as absent
OF pt_attendance_reg
-WHERE... - most filtering can go here
)
SELECT pt_emp_code
SUM (absent) AS no_of_days_absent
OF got_absent
WHERE the absent > 0
- AND pt_date > = TRUNC (SYSDATE, 'MONTH') - Date of filtering goes here
GROUP BY pt_emp_code
ORDER BY pt_emp_code
;
Output:
PT_EMP_CODE NO_OF_DAYS_ABSENT
------------ -----------------
R002 2
R003 4
R004 3
This assumes that there is exactly 1 row for each person, each day and that pt_hrs > = 0.
If the first date to a person is be a Friday, then that person is not counted as present the day before. Similarly, if the last day is a Friday, they will not be considered as present the next day, so they can be counted as absent on Friday, even though they were not really missing the Thursday or Saturday. This can be important if you filter by dates. Most filtering can be done in the subquery, but filtering dates must be done later, after the analytical function of the SUM is calculated.
-
Calculation of OTL Total regular hours in pay every two weeks for North America
Hi all
I develop OTL pre report payroll where it should display the employee with the Total details of regular hours worked for a period that is to pay every two weeks. It should include hours PTO and Non - PTO with not including overtime.
I can't find the exact entrance to the total regular hours... If it is a column of table or need to calculate.
Kindly help me to get
Thank you
BasawSerigne
Total regular hours is not stored anywhere you need to calculate the total hours of two location
1 get the values of the tables of the otl.
2. If you run the report after completing the transfer of the BEE to calculate the total of the item entry screen.Rajat.
-
Week, month, quarter and year calculation between two days with a quantity?
I have a problem that I can't solve.
Users enter a forecast (quantity) and a validity period between two dates.
Expected quantity is always a monthly forecast.
The problem is that the user wants to see the forecast by week, month, quarter and year.
Material | Quantity | Date_from | Date_to
Label45 | 1500 | 2009-09-01 | 2009-12-31
How can I easily calculate the amount so that the user can enter e.g. week 2009.41 and see the forecast this week?You should test for your specific environment, but I would be very surprised if a function has surpassed SQL directly.
-
Hello
I want to create a table like this
DAY OF THE WEEK OF THE YEAR
2007 W1 JANUARY 3, 2007
W2 2007 JANUARY 10, 2007
: : :
: : :
: : :
Wn 2010 December 29, 2010
I want the data from 2007 to 2010 like this and week should start as w1 for each year
my departure date is January 3, 2007Like this?
SQL> WITH row_gen AS ( 2 SELECT rownum rn FROM dual 3 CONNECT BY LEVEL <= 209) 4 SELECT TO_CHAR(dt, 'YYYY') year, 'W'||TO_CHAR(dt, 'IW') week, 5 dt thedate 6 FROM (SELECT TO_DATE('27-Dec-2006', 'dd-mon-yyyy') + (rn * 7) dt 7 FROM row_gen); YEAR WEE THEDATE ---- --- ----------- 2007 W01 03-JAN-2007 2007 W02 10-JAN-2007 2007 W03 17-JAN-2007 2007 W04 24-JAN-2007 . . . 2010 W49 08-DEC-2010 2010 W50 15-DEC-2010 2010 W51 22-DEC-2010 2010 W52 29-DEC-2010
John
-
Format of day, time of year, week, in figures
I would subtract one date from another. Number return weeks and days and I'd years, weeks and days. Formatting will not allow adjustment of the year. Any suggestions?
Hi max,.
I suspect that the unit is not available for the same reason 'month' isn't available, unlike the week, day, hour, minute, and second, it is not a stable unit. Conversion from weeks to days gives the same result for weeks in February 2004, as it does for weeks in July 1918, Conversion from months to days may require multiplying by 28, 29, 30 or 31 for one month, or a value with a fractional part for a period of more than a month long conversion (although this period was an integer when measured (or counted) in months.)
You can get an approximate value in doing some math.
In the example, the end result is a text string. Formula below.
C2: A - B
D2: QUOTIENT (DUR2DAYS (C2), 365.25) & "is" & QUOTIENT (MOD (DUR2DAYS (C2), 365.25), 7) & "w" & MOD (DUR2DAYS (C2), 7) & "d" "" ""
As mentioned, this is an approximation, and it is a text string, OK for display, but not useful (or usable) in all other calculations. A 'curiosity', more than anything.
Kind regards
Barry
-
Help! My Macbook Air has a high memory pressure.
Product: Macbook Air in early 2015
Plug-
256 GB of flash storage
1.6 GHz processor
4 GB memory
OS X Yosemite - Version 10.10.5
A few weeks memory of my Macbook Air pressure continued to increase, most of the time he was in the green zone, but it has been several times that I had the pressure of memory to be in the yellow box with a few tabs in Google Chrome. In addition, the Kernel_Task continues to rise as it was around 380-390 MB a few weeks ago and now he's moved more than 500 MB. I tried to restart and stop the computer several times as an attempt to decrease the Kernel_Task and even thought that the memory pressure is high, the CPU doesn't have a lot of problems, because it is essentially inactive between 65 and 80 percent.
What it looks like without all the eleven (shown) Google Chrome processes running? You should never see Swap used, and that tells me that you are using too many applications for your 4 GB memory available on your machine. With this RAM limited, you have to be very selective of what applications and browser tabs are open (you use) quit everything.
Maybe you are looking for
-
How can I have 2 email accounts open at the same time using the apple mail icon?
How to open 2 e-mail accounts at the same time?
-
Smart grant custody arise and I want to uninstall but cannot find it. It is not in my modules, extensions, programs and files... not the case! There are no buttons to click on the toolbar of my right hand etc. I am running foxfire 13.0.1, windows 7.
-
Tecra M5 Explorer does not display needs materials - ctrl + alt + delete
I bought a Toshiba Tecra M5 some 10 days ago and installed Windows XP, Office 2003... As I remember, early on, I had the following problem (this happens several times a day): When I want to run a task, for example: clicking on a subdirectory in the S
-
How to make the 'printerdiagnostic.diagcab' of MS?
All my printers has disappeared from the Printers & window Telec. When I try to add a printer, it error. I did a search on Ms Support. He recommended running a diagnostic program. I d/l 'printerdiagnostic.diagcab' from the page of Ms. Now how can
-
Compaq 6715 b compatible wireless adapters
Hello world I currently have a laptop Compaq 6715 b which will not boot with the error ' wireless network device 104 undetected. " System stopped. Remove device and restart. "Currently in the laptop wireless adapter is a Broadcom BCM4311. It is my un