Gets the number of records in the report based on the input of the user on the date and the number of days.
Hello
I need where there are quick dashboard that selects the date, second interval column consists of >, <, = and the third column is seen number (in days)
for example, the user enters: 12 18, 2015, <, 9. here I report who should get the data (records) 9 days earlier from the date specified (from 12/10/2015 to 18/12/2015).
Similarly for > =.
How to get there. I'm unable to write the script and I use the column date in my report. Ask that you please advice how to solve this problem.
Please find below the screen for reference.
Kind regards
Chandra Khalil.
Hello
Not exactly why you're doing the report this way. If the user must select, basically, a period of dates, would not easier to have a column of data with a between the operator and the user would select 2 dates (upper and lower intervals)?
In any case, it is possible to achieve what you want to do as a result of your approach. You could use when's CASE and have a more complex filter, but I think that it is better to have a few nested filters where you use the range operator to determine what date filter that you use (see image below)
Some notes about my filter. First of all, I am making the assumption that the operator is "=", then the number of days specified must be ignored and you just return the data for the selected date. You will notice also that in my filters, I got a cast so far, but if you are using a column that is already a timestamp so it won't be necessary.
This should achieve what you want.
See you soon,.
Pedro
Tags: Business Intelligence
Similar Questions
-
Get the difference in days between 2 dates in Essbase 9.3.1
How to calculate to get the difference in days between 2 dates in the format day of Essbase 9.3.1.la is 20090101 (yyyymmdd). If 2010907-20100917 = 10 days.
Start and end dates may extend over several years.@DateDiff does not exist in the 9.3.1 I think. With this assumption...
Could you use the CDF 'Functions of Date'? According to the docs (I've never used it):
@JdaysOffset - returns the number of days between the firstDate and the secondDate.See samplecode.oracle.com for the CDF. Just search for CDF and you will find it on the second page (I think) of the FMCS.
Or see this thread for another approach that I think the CDF under the covers: Re: Formate Date.
Of course, you could spend to 11 for DateDiff. :)
Kind regards
Cameron Lackpour
-
How to get the last business day of the previous month?
Hi all
We need the user as below,
If the user select 18 June 2015 ' quick dashboard as the input value, and then they want to see last month last day of work (business date: 29-may-2015) amount in report, if you have an idea please share with us.thanks
Note:
use under request we can able to get the last day of the previous month, we want to for the last business day of the last month, based on the date of entry of the user?
TIMESTAMPADD (SQL_TSI_DAY,-(1), TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH ("DIM_TIME". ("" DataDate ") *-(1) + 1,"DIM_TIME ". (("" DataDate "))
Thank you
Deva
Try this,
case when Dayofweek (timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15')) = 1 then timestampadd (sql_tsi_day, (Dayofmonth(Date '2015-06-15') *-1)-2, Date '' 2015-06-15) when Dayofweek (timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15')) = 7 then timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1-1, Date '' 2015-06-15) another timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15') end
As Ftsiot said in this post, it will work only to exclude the sat and Sun. Another one if you want to exclude regional holiday, you may need a calendar in DB table.
Thank you
AJ
-
All,
I am the need to get the 5th date of business for all dates in the dim_date table.
The dim_date table has a structure like this. There are more fields, but I'm in the process of what might be required here
calendar_dt | date_key | is_weekend | is_holiday | next_bus_date_key
22/11/2012. 20121122 | N | THERE | 20121123
23/11/2012. 20121123 | N | N | 20121126
24/11/2012. 20121124 | THERE | THERE | 20121126
What I need would be the 5th business day of each of this date. for example:
22/11/2012. 29/11/2012
23/11/2012. 30/11/2012
and so on, i.e. weekends and holidays are ignored
Any thoughts?
Thank you
S
Edited by: 957793 27 November 2012 04:47
Edited by: 957793 27 November 2012 04:55Hello
You can do a self-join when you join earlier dates to later dates, except weekends and holidays from later dates, like this:
WITH got_r_num AS ( SELECT e.dt , l.dt AS b_dt , ROW_NUMBER () OVER ( PARTITION BY e.dt ORDER BY l.dt ) AS r_num FROM data e JOIN data l ON l.dt BETWEEN e.dt + 1 AND e.dt + 14 -- May be different in your company WHERE l.wkend = 'N' AND l.holiday = 'N' ) SELECT dt , b_dt FROM got_r_num WHERE r_num = 5 ORDER BY dt ;
The 'magic number' 14 in the join condition is an upper bound on the actual number of days away the 5th working day can be. Where I work, the holidays are always at least 7 days apart, so the 5th working day is never further than 9 days real (5 days + 2 days + 2 days weekened) suite. Holidays may be more densely grouped in the same data posted Laureline, so I used a lot. If you don't know what number to use in your case, imagine that high.
-
Suggest the Sql query to get the years, months, days of the two dates.
Hi all
SELECT TO_DATE('06-02-2014','DD-MM-YYYY') - TO_DATE('01-04-1998','DD-MM-YYYY') SERVICE_DAYS OF THE DOUBLE
5790 SERVICE_DAYS
POWER REQUIRED:
YEARS MONTHS DAYS
15 10 5OUTPUT DISPLAY:
Select
Floor(5790/ 365.25),
Floor (mod (5790,365.25) / (365.25 / 12)),.
ceil (mod(5790,365.25 / 12))
Double;YEARS MONTHS DAYS
15 10 7 - TWO DAYS MORE
How they calculate manually is as follows:2014 02-06
1998-04-01
---------------
05 - days
2014 02-06
1998-04-01
+ 12
---------------
10 month 02 is lower than 04, so we borrow 12 months of TI (2014) years will be (2013)
2014 02-06
1998-04-01
-(1).
---------------
15. for the years since we-1Kind regards
Afzal.
OK... so try not not to multiply the reminder to add_months with 30 but to solve the 'day-thing' in a different way...
first step (data) is only my implementation testdata.
WITH DATA AS (SELECT TO_DATE('02-03-2014','DD-MM-YYYY') AS Degnide
TO_DATE('07-04-2008','DD-MM-YYYY') AS dayfrom
OF the double
UNION ALL
SELECT TO_DATE('12-04-2014','DD-MM-YYYY') AS Degnide
TO_DATE('11-05-1994','DD-MM-YYYY') AS dayfrom
OF the double
UNION ALL
SELECT TO_DATE('06-02-2014','DD-MM-YYYY') AS Degnide
TO_DATE('01-04-1998','DD-MM-YYYY') AS dayfrom
OF the double
)
calc AS (SELECT months_between (dayto, dayfrom) SERVICE_DAYS
Degnide
dayfrom
DATA)
SELECT Degnide
dayfrom
floor(service_days/12) IN years
floor (mod(service_days,12)) AS month
, BUSINESS sign (EXTRACT (Degnide DAY) - EXTRACT (DAY FROM dayfrom))
WHEN THEN-1 EXTRACT (DAY FROM Degnide) + 30 - EXTRACT (DAY OF THE dayfrom)
WHEN 0 then 0
WHEN 1 THEN EXTRACT (Degnide DAY) - EXTRACT (DAY FROM dayfrom)
0 OTHERWISE
end as days
CALC
HTH
-
Compare and get the number of days since the same date field
Hello
I need to get the results in days when comparing the same field, date
For example,.
Primary_key_field Date_field
100000002 1 January 10
100000004 February 1st, 10
100000005 30 April 10
100000006 April 18, 10
100000007 29 April 10
100000008 May 1st, 10
extract the first two date_field records based on the primary_key_field. (January 1, 2010 and February 1, 2010) and compare and find the difference and who appear in number of days, the same fetch two disks and do the same math... How can I achieve this... is it possible to make the SQL thro? Please help me solve this problem...
Thank you and best regards,
KBG.This is the query using functions oracle Analytics
Primary_key_field Date_field
100000002 1 January 10
100000004 February 1st, 10
100000005 30 April 10
100000006 April 18, 10
100000007 29 April 10
100000008 May 1st, 10Select rn, date_field, next, next - date_field "Diff".
de)
ROW_NUMBER() SELECT over (ORDER BY primary_key_field) rn,
date_field, LEAD (date_field) OVER (ORDER BY date_field) next
FROM table_name)
/ -
SQL query to get the number of days monthwise
Hello
I'm new to sql, can someone please tell me query to find the number of days between the two dates months wise.
say
FIRSTDATE last date
21/03/2011-25/06/2011
March April May June
9 22 23 18Hello
Welcome to the forum!
Here's one way:
WITH all_dates AS ( SELECT start_date + LEVEL - 1 AS a_date FROM ( SELECT TO_DATE ('21/03/2011', 'DD/MM/YYYY') AS start_date , TO_DATE ('25/06/2011', 'DD/MM/YYYY') AS end_date FROM dual ) CONNECT BY LEVEL <= end_date + 1 - start_date ) SELECT TO_CHAR ( TRUNC (a_date, 'MONTH') , 'fmMonth YYYY' ) AS month , COUNT (*) AS num_days FROM all_dates WHERE a_date - TRUNC (a_date, 'IW') < 5 GROUP BY TRUNC (a_date, 'MONTH') ORDER BY TRUNC (a_date, 'MONTH') ;
What is a 'working day '? I guess you mean every day except Saturday or Sunday, but the query aboveare sometimes figures less than you have asked:
MONTH NUM_DAYS --------------- ---------- March 2011 9 April 2011 21 May 2011 22 June 2011 18
Are a few days working on Saturday or Sunday? How do you get the 22 working days in April 2011 and 23 in may?
SQL is good at obtaining results with a variable number of rows, but you have to say exactly the desired number of columns when you write the query.
If you really need the output of the way you said, with any number of columns, then watch in swing or a grouping of the chain . See the FAQ forum
https://forums.Oracle.com/forums/Ann.jspa?annID=1535
"4. How can I convert rows to columns. -
How to get the last day of the weekend rather than a month
Hi all
Is the request appropriate and preferable to use to get the last business day of the month below?
SELECT to_date('13.08.2014','dd.mm.yyyy') + MAX(RNUM) LastDay(nonweekend) FROM (SELECT ROWNUM RNUM FROM ALL_OBJECTS where rownum <=31) WHERE ROWNUM <= 31 ANd TO_CHAR(to_date('13.08.2014','dd.mm.yyyy') + RNUM, 'DY','NLS_DATE_LANGUAGE=ENGLISH' ) NOT IN ('SAT' , 'SUN') and to_date('13.08.2014','dd.mm.yyyy') + RNUM <= last_day(to_date('13.08.2014','dd.mm.yyyy'))
I have to use this motion for production.
East - recommended to use?
You can change your query this way:
WITH t AS (SELECT trunc (to_date ('& calc_date', 'dd.mm.yyyy'), 'mm') + level - 1 calc_date)
OF THE DOUBLE
CONNECT BY LEVEL<= last_day(to_date('&calc_date',="" 'dd.mm.yyyy'))="" -="" trunc(to_date('&calc_date',="" 'dd.mm.yyyy'),="" 'mm')="" +="">=>
)
Select max (calc_date)
t
where to_char (calc_date, 'DY', 'NLS_DATE_LANGUAGE = ENGLISH') NOT IN ("SAT", "Sun");
-
Hello
I did a feature where when I go to any expiry date that I must check with the current date... and get the difference in days.
When I change the value to this fuction 2012-01-05 and my current date is 2011-12-22 that I am getteing diffDays = 45, when I pass 2011-12-25 and my current date is 2011-12-22, then I'm diffDays = 34.
I didn't know that's why 31 days added in my diffDays? If there are 31 days month so it will add 31 and if the month is 30 we can add 30 days? I didn't know where I am going wrong. I enclose my code that I use. Pls check and tell me where I'm wrong...
public static String isBookExpired(String date) { System.out.println("**********"); date = date.trim(); int index = date.indexOf(" "); if(index != -1) { date = date.substring(0, index); } String strArr[] = stringtoArray(date , "-" ); Calendar substribtionDt = Calendar.getInstance(); //myCalendar. substribtionDt.set(Calendar.YEAR, Integer.parseInt(strArr[0])); substribtionDt.set(Calendar.MONTH, Integer.parseInt(strArr[1])); substribtionDt.set(Calendar.DATE, Integer.parseInt(strArr[2])); Calendar today = Calendar.getInstance(); long diffDays = ( substribtionDt.getTime().getTime() - today.getTime().getTime()) / (24 * 60 * 60 * 1000); if(diffDays < 0) { return "Yes"; } else return "No"; }
months in a calendar object index starts with 0 rather than 1 in the real world, you must set the value of the months in the calendar by subtracting by the date that you enter.
-
How to get the number of records printed for the report in the dashboard
Hello
I would like to get the number of records printed at the bottom of each report as dashboard:
< 1-25 of 6300 > instead of < 1-25 >
Any help is appreciated
Concerning
BHello
Check out the blog of Miky Schreiber;
http://www.miky-Schreiber.com/blog/permalink, guid, e964552b-eb6e-449b-b2c6-42adea2376cd.aspx
Good luck
Daan Bakboord
http://obibb.WordPress.com -
Unable to get the total number of records processed by the processor of trade rules
Details of the environment
======================
Disqualification Version: 12.1.3.0.0
I use a business rules processor to implement multiple business rules on one record and I am looking for a summary of the number of records increased and does not have a specific rule.
To illustrate:
Suppose there are 2 rules, invalid number in Column1 and valid number on Column2.
10 records to process and 3 folders don't rule 1 (valid on column1) and 9 entered failure of rule 2 (valid number on Column2).In the browser of result of the processor Business, the number of past records and failed is displayed but is not part of the output of the processor itself. In the example above, there will be 1 pass and 9 fail records and given the values of said the total number of records can be derived which is 10.
This is why the expected output will be:
Success of failure
Rule 1:7 (10-3) 3
Rule 2: 1 (10-1) 9
Note: The number of records that failed can be derived from the table of the rule ID but I don't know how to get the total number of records in order to calculate the number of records that a given rule.I tried to publish the County of acceptance and rejection in the browser of result of the processor Business in an intermediate table and ask the same intermediate table to get the pass and fail values but Disqualification does not allow to write and read the same intermediary object in a single process. What is the best way to get the number of records total handled by the processor business rules? This kind of attributes (that do not exist only in the browser of result) can be included in the output of the processor in the next version of the Disqualification?
In addition, the intermediate table contains only 1 sheet with pass and failure values while the exceptions which have individual failure on each rule contains 12 Archives. What would be the best approach to merge a single record into multiple records according to the example below?
Staging table
Success of failure
1 9Exception table
Single ID ID rule
Rule 1 Record1
Rule 1 Record2
Rule 1 record Record3
Rule 2 Record1Exception table with: staging Table data merge
Rule ID ID Unique Pass Fail Total
Rule 1 1 9 10 Record1
Rule 1 1 9 10 Record2
Recording rule 1 Record3 1 9 10
Record1 rule 2 1 9 10
Please notify.Hi Jason,
The best way to explain how to do this is with an example project (DXI). I'll send you one in offline mode.
-Mike
-
How can I get the classic report value when I click on the record?
Hi all
I have a simple classic report and I want to get the empno when I click on record. For example, when I click on record 1, and I'll go '7369', if I click on the 3 card, and I'll go '7521'. How can I do this? Please help, thanks!
Hi jane.kuang,
Jane.Kuang wrote:
Thank you very much!!! Your message is useful for me. But this javascript has something wrong. When I click on the first time, the empno appears only once, but when I click on the other record, empno appear twice, and I click on the third time, it appears three times... I'm new to JS, I don't know how to fix it. Thank you!
Use instead the dynamic action to that effect.
Here are the steps:
- Change your region classic report-> section 'Attributes'-> 'ID' static-> give an id say myempregion static
- Create a dynamic action with the following attributes:
Event: click on
Selection type: jQuery Selector
jQuery Selector:
#myempregion table.uReportStandard tbody tr
Action: Run the JavaScript Code
Code:
var empno = $(this.triggeringElement).find('td[headers="EMPNO"]').text(); alert(empno); $('#P21_X').val(empno);
Items concerned: keep it unselected
- Change once created, your dynamic action-> go to section 'Advanced'-> set 'Extended event', 'dynamic'.
This will fix the following in the code of the Para:
- The jQuery Selector used by Para to trigger the click event is bad. This will fix the multiple alerts.
- Para code won't work on loading the page, but if there are many rows in the table and pagination for the report is in place, and then when you paginate your report, it will not work. But it will work with dynamic action 'Scope of the event' the 'Dynamic' value even when you paginate the report.
- Finally, most of the dynamic interactions page must be converted to dynamic actions, this will help the maintainability of the code, instead of stacking the javascript in your page.
Kind regards
Kiran
-
Can I get the total number of records that meet the conditions of a query using the Table API?
Hello
A < row > TableIterator is returned when I ask operations using the index of tables. If I want to get the total number of records, I count one by one using the returned TableIterator < row >.
Can I get the total number of records directly meets the conditions of the query?
I can get the total number of records directly the request of the meeting of the conditions of CLI using the command Global table - name tableName - count - index index-name-field fieldName - start startValue-end endValue.
Can I get the same results using the Table API?
I used MongoDB and NoSQL Oracle for about a year. According to the experience of the use of these dbs, I think mongoDB querying interface is powerful. In the contras, the query interface is relatively simple, which results is a lot of work that is usually a long time in the client side.
Hello
Counting records in a database is a tricky thing. Any system that gives you an accurate count of the records will have a hotspot of concurrency on updates, namely the place where the counting is maintained. Such a count is a problem of performance in addition to competitive access problem. The problem is even more difficult in a system widely distributed such a NoSQL database.
The CLI has overall command that counts, but does so by brutal force - iterate keys that correspond to the parameters of the operation. This is how you must do this within the API. There is not a lot of code, but you have to write. You certainly want to use TableIterator
TableAPI.tableKeysIterator (), because a key iteration is significantly faster than the iteration of lines. Just one iteration and count. If you use TableAPI.multiGet () and a key with a touch of brightness full then, in fact, count the results as they are returned in a single piece (a list).
Kind regards
George
-
How do I get the number of incorrect records when you use external tables
Hi all, I have an external table DEPT,.
DEPT. DAT
20. ELECTRONICS
10. SHOES
30. CAMERA
Select * from the Department; only 10 and 30 dept will be led as deptdescr for 20 that there are more than 10 in length so this record will go into the wrong file,
y at - it count any query to display the folder or get any query to get the record to view the entries entries wrong file rather that will drop and see how much is rejected.
Table:
CREATE TABLE DEPT ( DEPT NUMBER, DEPTDESCR VARCHAR2 (10 CHAR) ) ORGANIZATION EXTERNAL ( TYPE ORACLE_LOADER DEFAULT DIRECTORY BATCH_INBOX ACCESS PARAMETERS ( RECORDS DELIMITED BY '\r\n' BADFILE BATCH_BAD:'UPS_DEPT_LOAD_%p.bad' LOGFILE BATCH_LOG:'UPS_DEPT_%p.log' NODISCARDFILE FIELDS TERMINATED BY '|' MISSING FIELD VALUES ARE NULL ( DEPT, DEPTDESCR ) ) LOCATION (BATCH_INBOX:'DEPT.DAT') ) REJECT LIMIT UNLIMITED NOPARALLEL NOMONITORING;
You can use the wrong file as the data file for another external table, with the entire line in a single field. Please see the demo below.
Scott@orcl12c > CREATE or REPLACE DIRECTORY batch_inbox AS 'c:\my_oracle_files '.
2.
Created directory.
Scott@orcl12c > CREATE or REPLACE DIRECTORY batch_bad AS 'c:\my_oracle_files '.
2.
Created directory.
Scott@orcl12c > CREATE or REPLACE DIRECTORY batch_log AS 'c:\my_oracle_files '.
2.
Created directory.
Scott@orcl12c > CREATE TABLE DEPT
2 (
NUMBER 3 DEPT,
4 DEPTDESCR VARCHAR2 (10 CHAR)
(5) ORGANIZATION EXTERNAL
6 (TYPE ORACLE_LOADER
7 DEFAULT DIRECTORY BATCH_INBOX
8 ACCESS SETTINGS
9 (RECORDS DELIMITED BY "\r\n"
10 BADFILE BATCH_BAD: 'UPS_DEPT_LOAD.bad'
11 BATCH_LOG:'UPS_DEPT_%p.log LOGFILE'
12 NODISCARDFILE
13 FIELDS TERMINATED BY ' |'
14 MISSING FIELD VALUES ARE NULL
15 (
DEPT 16,
17 DEPTDESCR
18 )
19 )
LOCATION 20 (BATCH_INBOX:'DEPT.) DAT')
21 )
RELEASE 22 UNLIMITED LIMIT
23 NOPARALLEL
24 NOMONITORING;
Table created.
Scott@orcl12c > SELECT * FROM dept
2.
DEPTDESCR DEPT
---------- ----------
10 SHOES
CAMERA 30
2 selected lines.
Scott@orcl12c > CREATE TABLE DEPT_bad
2 (
3 the_whole_row VARCHAR2 (4000)
(4) ORGANIZATION EXTERNAL
5 (TYPE ORACLE_LOADER
6 DEFAULT DIRECTORY BATCH_INBOX
7 ACCESS SETTINGS
8 (RECORDS DELIMITED BY "\r\n"
9 NOLOGFILE
10 FIELDS TERMINATED BY '\r\n '.
11. THE MISSING FIELD VALUES ARE NULL
12 (
13 the_whole_row CHAR (4000)
14 )
15 )
16 RENTAL (BATCH_BAD:'UPS_DEPT_LOAD.) THE BAD ")"
17 )
RELEASE 18 UNLIMITED LIMIT
19 NOPARALLEL
20 NOMONITORING
21.
Table created.
Scott@orcl12c > SELECT * FROM dept_bad
2.
THE_WHOLE_ROW
--------------------------------------------------------------------------------
20. ELECTRONICS
1 selected line.
-
How to get the number of lines in a region of report
Hi all
Is there a way to get the number of rows returned in a report region, without issuing an another 'select count (*) from une_table?
I mean something like the substitution string #ROW_NUM # but for the total of the lines.
Thank you
Pedro.http://download.Oracle.com/docs/CD/E17556_01/doc/user.40/e15517/UI.htm#CHDDGGEG
For parts of classic report, the footer region supports the following substitution strings:
#ROWS_FETCHED # indicates the number of lines read by the reporting engine Oracle Application Express (the size of the page). You can use these substitution strings to display messages to the user. For example:
Read #ROWS_FETCHED # #TIMING # seconds lines.
* #TOTAL_ROWS # displays the total number of rows that satisfy an SQL query used for a report.
#FIRST_ROW_FETCHED # and #LAST_ROW_FETCHED # show the range of displayed lines. For example:
Until #FIRST_ROW_FETCHED # by #LAST_ROW_FETCHED # of #ROWS_FETCHED # displayed >
Van
Trent
Maybe you are looking for
-
Wireless more than Seagate and office
Hello Recently, I bought a Seagate Wireless Plus to use with my Ipad2. I need mainly to be used for a large number of Word and Excel docs I have is that I use when I am away from home. I noticed that whenever I try to open a document using the Seagat
-
Why yahoo page does not appear when I type the name of the site?
I used to be able to type a name of a store, etc. on the top and the site would come. Now appears a yahoo search page.
-
video drivers do not work on windows 8 When are there drivers? This is the error I get on the drivers from the hp site http://ImageShack.us/photo/my-images/405/hpprob.PNG/
-
All of a sudden yesterday my screen display is reversed. As it is not of portrait and landscape now. How should I do? [Moved from comments]
-
Menu without going through (CTI Route Point?)
I'm setting up a compound that when DN allows to bypass the automated menu system and placed the appellant directly in the queue. I have the same as other DN CTI Road Plan Setup that bypasses its menu system. There is something somewhere that I'm mis