How to reset a number of rows based on a column value?
OracleBI Discoverer 10g (10.1.2.3)Oracle Business Intelligence Discoverer Plus 10g (10.1.2.55.26)
I have a Scout more State showing point receipts, receipt of the dates, and if the reception has been inspected. I've got items that need to be inspected each 5th receipt. There must be a function of hand-dandy, that I can use to do that, right?
Item Receipt Date Inspected
Bracket 1/1/2009 Y
Bracket 2/1/2009 N
Bracket 3/1/2009 N
Bracket 4/1/2009 Y <--let's assume someone didn't follow the instructions
Bracket 5/1/2009 N
Bracket 6/1/2009 N
Bracket 7/1/2009 N
Bracket 8/1/2009 N
Bracket 9/1/2009
I'm looking to count receipts and reset the inspection counter = YItem Receipt Date Inspected Inspect_Count
Bracket 1/1/2009 Y 0
Bracket 2/1/2009 N 1
Bracket 3/1/2009 N 2
Bracket 4/1/2009 Y 0
Bracket 5/1/2009 N 1
Bracket 6/1/2009 N 2
Bracket 7/1/2009 N 3
Bracket 8/1/2009 N 4
Bracket 9/1/2009 5 <-- receiver should inspect on this receipt
I'm open to other methods if the mine seems to be a failure.-Tracy
Hello
I don't think you can do it is Discoverer more only because you must divide twice once to get all inspected records and still counting the days between them.
What you can do is in Discoverer Admin add an element to the EUL calculated:
inspections = COUNT (DECODE (inspected, 'Y', 1)) OVER (ORDER BY reception Date)
In Discoverer, you can add a calculation:
Count (inspected) over (PARTITION BY ORDER BY Date of receipt) - 1
to produce the County to inspect.
Rod West
Tags: Business Intelligence
Similar Questions
-
[8i] way to add a specific number of rows based on a column value?
I know that the version of Oracle is old:
Oracle8i Enterprise Edition Release 8.1.7.2.0 - Production
PL/SQL Release 8.1.7.2.0 - Production
CORE 8.1.7.0.0-Production
AMT for HP - UX: 8.1.7.2.0 - Production Version
NLSRTL Version 3.4.1.0.0 - Production
I'm trying to get an old database data in a specific format, and this should be run several times during the next year, until we can phase out the old database. Unfortunately, it is not particularly useful for formatting the data after he is questioned, so if a SQL solution can be found, it would probably be best.
Some examples of data:
I want to get these results:CREATE TABLE testabc ( item CHAR(25) , qty NUMBER(13,4) ); INSERT INTO testabc VALUES ('Item1',1); INSERT INTO testabc VALUES ('Item2',3); INSERT INTO testabc VALUES ('Item3',1); INSERT INTO testabc VALUES ('Item4',2);
Either format would be acceptable. The key is to have the same number of rows for an article as its quantity.ITEM QTY ------------------------- --------------- Item1 1.000 Item2 3.000 --blank row --blank row Item3 1.000 Item4 2.000 --blank row OR ITEM QTY ------------------------- --------------- Item1 1.000 Item2 1.000 Item2 1.000 Item2 1.000 Item3 1.000 Item4 1.000 Item4 1.000
Any help on this would be appreciated. I wasn't sure if maybe that this would require a CONNECT BY statement. With my luck, it requires one of the functions which did not become available until 9i...
I tried this:
but he gave me a bunch of empty lines.SELECT CASE WHEN LAG(qty) OVER(PARTITION BY item ORDER BY item, qty DESC) = 1 THEN item END AS item , CASE WHEN LAG(qty) OVER(PARTITION BY item ORDER BY item, qty DESC) > 1 THEN LAG(qty) OVER(PARTITION BY item ORDER BY item, qty DESC) - 1 END AS qty FROM testabc ;
Thank you!Hello
Here's a way to do it in Oracle 8.1
SELECT CASE c.n WHEN 1 THEN t.item END AS item_col , CASE c.n WHEN 1 THEN t.qty END AS qty FROM testabc t , ( SELECT ROWNUM AS n FROM all_objects WHERE ROWNUM <= 10 -- If you know an upper bound ) c WHERE c.n <= t.qty ORDER BY t.item , c.n ;
This assumes that this quantity is never more than the number of lines in object (usually at least 5000). If you need more lines, you can cross join object to itself, with the result a limit of 25 million lines or more.
The WHERE clause in the subquery c is not absolutely necessary, but it will make things faster.Published by: Frank Kulash, December 19, 2011 15:33
The solution above is for the first set of results, with blank lines.
For the results of the second, with lines no NULL duplicate, just lose the CASE expressions in the FROM clause:SELECT t.item , t.qty FROM testabc t , ( SELECT ROWNUM AS n FROM all_objects WHERE ROWNUM <= 10 -- If you know an upper bound ) c WHERE c.n <= t.qty ORDER BY t.item , c.n ;
-
How to reset the number of activations
How can I reset my number of activations so I can I use ADE to download books to my Kobo again? I get an error message saying I have exceeded my number of activations and I only allowed him on my PC.
Sent a PM, please check your Inbox.
-
How to reset the number of Badge Application AS3
Hello
I sent a notification of transmission of Apple successfully using a native extension for adobe air by anders-tbl. The notification simply affects the badge number 1 and has a little message.
What confuses me, is how to reset this count badge once that a user opens my request again or opens the application by clicking the notification? Badge County remains at 1, even if I delete the app and reinstall, it's still there! ??
I know that I can reset the counter of the badge by sending a notification with badge = 0, but I can't do so by sending a blank APN with badge set to 0 you get only the device of chips on the first application load dynamically? Surely, you set this via a kind of AS3 function? I can't seem to find any help search google at all.
If anyone knows or can push me in the right direction on how you are supposed to do this it would be great.
See you soon,.
Push notifications don't are currently not supported in the AIR. I mean there is no public API Actionscript to activate the Push Notifications in the AIR on any platform. There therefore no ActionScript API to reset the batch either number(for iOS). Since you are using native extensions, you will only have to rely on them to provide you with the number.
-
How to limit the number of rows returned in a query
Hi friends,
I want to limit the number of rows returned by my request to some 10 lines. How to do this. When I try to make some 6 rows with the rownum < 10 its giving results for a particular Department and that too only... btw I'm bundling my table and includes much a table joins and will order the results of the table by a column... How to do this...Run it:
select * from (your query goes here) where rownum < 10
Nicolas.
-
How can I get number of rows in DB for view with "only up to line number.
Hi all
I use jdeveloper 11.1.1.3.0
in the development of the object view, only until the line number is set to 100, but it has 1000 row in DB.
now page jspx, I need to get the number of rows in db (1000), how can I get it?
If I get iterator or view are of the object status is not true, it returns the value 100.
How can I get 1000?Given that you have set the limit line number for the VO, VO will always and forever don't have 100 records or less. If you want the total number in the comic book, you need to create an another VO that is not the count (*) or one that does not limit the number of rows.
John
-
How to determine the number of rows in the database and save the result to a local variable?
Hello
I'm a newbie in the use of TestStand, databases and SQL, and now I've met difficulties. I use TestStand 2014 (32 bit).
I have a need to know the number of rows in a database and save that number in a local variable. I tried to practice using the database of the Types of step provided with TS. I tried to use the following in a SQL statement:
Locals.NumberOfRows = ("SELECT COUNT (*) FROM TEST_TABLE")
It returns an error: specified value is not the expected type. My goal is possible in this way, or I'm doing this completely wrong?
-RautSa
Thank you for your response, Norbert. I have a database of who wins new values at random, and sometimes I need the exact number of rows in this table.
I managed to achieve my goal by using the SQL statement: "SELECT COUNT (*) as Rowcount OF TEST_TABLE", followed by a data GET operation, which records that number of lines in a local variable.
-RautSa
-
How to display the number of lines of time giving the values of the columns?
Hi all
I want to display the number of rows times the value exists in the column num in the query below
Published by: Nag Aswadhati on November 1, 2012 12:34with t AS ( SELECT 'venkatesh' NAME, 'hyd' LOC, 2 NUM FROM DUAL UNION ALL SELECT 'prasad' NAME, 'hyd' LOC, 3 NUM FROM DUAL UNION ALL SELECT 'krishna' NAME, 'hyd' LOC, 1 NUM FROM DUAL ) SELECT T.* FROM T CONNECT BY ROWNUM <= NUM Expected output: venkatesh hyd 2 venkatesh hyd 2 prasad hyd 3 prasad hyd 3 prasad hyd 3 krishna hyd 1
Aswadhati NAG wrote:
Hi allI want to display the number of rows times the value exists in the column num in the query below
Expected output: venkatesh hyd 2 venkatesh hyd 2 prasad hyd 3 prasad hyd 3 prasad hyd 3 krishna hyd 1
With the help of connection by: -.
with t AS ( SELECT 'venkatesh' NAME, 'hyd' LOC, 2 NUM FROM DUAL UNION ALL SELECT 'prasad' NAME, 'hyd' LOC, 3 NUM FROM DUAL UNION ALL select 'krishna' name, 'hyd' loc, 1 num from dual ) select t.name, t.loc from t connect by level <= num and name = prior name and (prior sys_guid() is not null); NAME LOC --------- --- krishna hyd prasad hyd prasad hyd prasad hyd venkatesh hyd venkatesh hyd 6 rows selected
-
To return a specific number of rows based on the data in a table column
Hello
I have a table named orders that has the column orderid and noofbookstoorder in addition to the other columns.
I want to query the orders table and according to the value of the value of "noofbookstoorder" that return number of lines.
For example
OrderID noofbookstoorder
3 s
2 3
3 2
When I ask the above data saying
Select * from orders where orderid = 2;
because there noofbookstoorders 3 value the query should return 3 rows and when I query
Select * from orders where orderid = 3;
He must return to 2 rows and
Select * from orders where orderid = 1;
should return 1 row.
Is it possible to do this. If Yes, then how can I write my query.
Thanks in advance.with t as ( select 1 Orderid,1 noofbookstoorder from dual union all select 2,3 from dual union all select 3,2 from dual ) select t.* from t, table(cast(multiset(select 1 from dual connect by level <= noofbookstoorder) as sys.OdciNumberList)) where Orderid =
/ For example:
SQL> with t as ( 2 select 1 Orderid,1 noofbookstoorder from dual union all 3 select 2,3 from dual union all 4 select 3,2 from dual 5 ) 6 select t.* 7 from t, 8 table(cast(multiset(select 1 from dual connect by level <= noofbookstoorder) as sys.OdciNumberList)) 9 where Orderid = 2 10 / ORDERID NOOFBOOKSTOORDER ---------- ---------------- 2 3 2 3 2 3 SQL> with t as ( 2 select 1 Orderid,1 noofbookstoorder from dual union all 3 select 2,3 from dual union all 4 select 3,2 from dual 5 ) 6 select t.* 7 from t, 8 table(cast(multiset(select 1 from dual connect by level <= noofbookstoorder) as sys.OdciNumberList)) 9 where Orderid = 3 10 / ORDERID NOOFBOOKSTOORDER ---------- ---------------- 3 2 3 2 SQL> with t as ( 2 select 1 Orderid,1 noofbookstoorder from dual union all 3 select 2,3 from dual union all 4 select 3,2 from dual 5 ) 6 select t.* 7 from t, 8 table(cast(multiset(select 1 from dual connect by level <= noofbookstoorder) as sys.Odc iNumberList)) 9 where Orderid = 1 10 / ORDERID NOOFBOOKSTOORDER ---------- ---------------- 1 1 SQL> -- And if you want to select multiple orders SQL> with t as ( 2 select 1 Orderid,1 noofbookstoorder from dual union all 3 select 2,3 from dual union all 4 select 3,2 from dual 5 ) 6 select t.* 7 from t, 8 table(cast(multiset(select 1 from dual connect by level <= noofbookstoorder) as sys.Odc iNumberList)) 9 where Orderid in (2,3) 10 / ORDERID NOOFBOOKSTOORDER ---------- ---------------- 2 3 2 3 2 3 3 2 3 2 SQL>
SY.
Published by: Solomon Yakobson, October 26, 2009 07:36
-
How to set Max number of rows in a table?
Hello
I'm working on a SCADA interface. In this application, there are different tables with vertical scroll bar.
I prefer to make it visible only initialized lines (I've initialized 40 empty rows in a table with an array of strings). Since the window contains all 40 lines, but only 20 rows, I put the number of lines in the "table properties window" at 20; So I added a vertical scroll bar.Now, when a user, do scroll the scroll bar, it can check not only the initializated 40 lines, but any number of lines.
There is a way to view only a limited number of lines?Thanks in advance!
-
How to calculate the number of Avg based on month
Hi all
I want to calculate Avg based on averages of the month
Ex: i have made Total column
current month like July Thn avg = total/7.
then even report working in October than avg time = total/10.
Any help.
Thank youYou must specify a digital for parameter 2. The Substring function takes the source from character string parameters and the length of the unit. In my example it will take the value of the variable current_month and returns the characters of the 8th position for 2 characters (so character 8 and 9). For example, instead of 'Time' happening. "" Month "you must pass the literal number 8. So I think the actual code you need is:
SELECT "Applications and financial accounts. "" Value "/ CAST (SUBSTRING (VALUEOF ("CURRENT_MONTH") OF 8 TO 2) as INT)"financial accounts and Applications.
NB I'm assuming that the value that you want to divide by the number of current month is called "Applications and financial accounts. "" Value ", please change it's column that you never use.
Please mark it as useful to the answer
-
reset the number of subform based on the value of the selected drop-down list
Hello
I have a questions. I have a form called request. Inside of the application form, there is a subform called MultiForm, which is repeatable. Application form has a drop down DropdownList1. MultiForm has buttons 'Add profile' and 'delete profile '.
The form is the first launch, query appears with DropDownList1, MultiForm button "Add Profile".
That the user clicks on "Add Profile", a second MultiForm is insert. On this second MultiForm, there is the 'Add Profile' button and 'delete profile '.
When the user change the value of the DropDownList1, I want the number of MultiForm reset so that it has only this MultiForm. The 2nd, 3rd, etc., MultiForm is deleted.
Also, I want the "Add Profile" button to show only on the first MultiForm, not the subsequent MultiForm.
I came with the scripts below:
Remove MultiForm (added under the change event for DropDownList1.
function resetMyForm (myForm) {}
var vCount = myForm.count;
If (vCount > 1) {}
If (vCount == 3) {}
myForm.removeInstance (2);
myForm.removeInstance (1);
} ElseIf (vCount == 2) {}
myForm.removeInstance (1);
} else {}
do nothing
}
} else {}
do nothing
}
}
-The reason this function works for me because I'm only accommodate max 3 MultiForms to insert and there is always a MultiForm on the page. I'm looking for a more "dynamic" script instead of the 'static' script above. Any suggestions would be greatly appreciated.
Also, I have another question: I want the "Add Profile" to be present on the first MultiForm only. As new MultiForm added, I don't want the "Add Profile" button to display on the subsequent MultiForm (with the exception of the first form)
Is there an example of a function that I can use? Where should I insert this function?
Thank you very much for your help.
Hello
A quick fix would be the setInstances() method.
I'm surprised you found removeInstance() to work without calling instanceManager or trait shorthand (_) underscore.
_myForm.setInstances(0); // remove all instances _myForm.setInstances(1); // create a new blank instance
Hope that helps,
Niall
-
How to limit the number of rows returned in the PIF
Hi friends...
How to restrict the no of lines displayed from a few 10 rows for example... at the BEEPIf its in RTF, you can use position to restrict.
<><11]?>You can also restrict the it in your sql query using ROWNUM.
11]?> -
How to RESET the number activation exceeded on LR6
Hello, I installed LR6 on my new PC, the former no longer works and so I cannot uninstall son LR and I have another computer with installed LR. When I test to start LR on the new PC a box appears saying that I have exceeded the activation name allowed and even if I click on the dispute "I already uninstalled LR on a computer only", nothing helps and I can no longer start LR. What do I do?
Contact adobe during the time pst support by clicking here and, when available, click on "still need help", https://helpx.adobe.com/contact.html , and request activation reset account.
[left Adobe Creative Cloud for download, installation, commissioning]
-
Filter the rows based on another column
Hello
I have a table like this:
user_id team sla_team rownum 11 one 0 1 22 one 0 2 33 b 1 3 44 b 1 4 55 c 3 5
I want a list of the first order of 3 users of sla_team.
If 2 or more users have the same sla_team, must list both of them.
In this case, I want to return user_id: 11, 22, 33, 44
A way to do it is like this:
Select *.
table
where sla_team < = (select max (sla_team) in the table where rownum < = 3)
But my table is bigger and more complex query.
Any other sugestion?
Thank you and sorry for my bad English.
Hello
Whenever you have a problem, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) of all the tables involved, so that people who want to help you can recreate the problem and test their ideas.
Also post the exact results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum: Re: 2. How can I ask a question on the forums?
This sounds like a job for a Query of Top - N, like this:
WITH got_r_num AS
(
SELECT table_x. *- or whatever the columns that you want to
, EVALUATE () DURING (ORDER BY sla_team) AS r_num
FROM table_x
-WHERE... - If you need any filtering, put it here
)
SELECT *- or the list of all columns except r_num
OF got_r_num
WHERE r_num<=>=>
ORDER BY r_num
;
Maybe you are looking for
-
6 s/iOS iPhone 9.3.5 Confusion of backup/restore/synchronize
I recently needed to backup, delete and restore my 6s more to unlock it by the carrier. I downloaded iTunes on my laptop and made a captive backup via iTunes and also a backup over Wi - Fi to ensure against corruption. According to receipt messages,
-
Re: How to turn the webcam on satellite C660 - 18 c?
Tried downloading drivers but still windows cannot detect my integrated webcam. Windoms 7 Home premium 64 - bit operating system. program files (x 86) (not sure if that helps) Also I installed the camera assistant software, but when I run it says cam
-
compatible vista-programs-7 and vice versa?
Could I ask on likenment of compatibility for a program or a driver to run without problems on vista if made for xp or 7? Im not having much success - some CPRS for XP won't run, and drivers are picky - could I suppose that there is a compatibility f
-
BlackBerry Smartphones Documents To Go will not refresh
Hey guys,. Blackberry pearl here new user. I upgraded to OS 4.5 and installed documents to go. However, when I click on "Check for Updates" and follow the instructions to update to 1,005, I get an error in the sense of 'downloaded module is incompa
-
How to get the average time of the day
HelloOracle 11g R2. Looking for a way to determine an average duration of the day. The data in the table are the following and are stored as VARCHAR2. These data represent the time of day a work finished and is stored each day in the table.(HH)00:21: