Need to remove duplicate rows from distinct query
Hello,
I have the following query:
SELECT tiab.abnr abnr, tiab.namn namn, (CAST(tiab.GATUNR||' '||tiab.gata AS VARCHAR2(254))) ADR, tiab.boxpnr boxpnr, tiab.boxort boxort,
(CAST(tiab.RIKTNRDISPLAY AS VARCHAR2(254))) RIKTNR, (CAST(tiab.TELNRDISPLAY AS VARCHAR2(254))) TELNR,
DECODE((select count(tior.tigilopnr) from tis.tior where abnr = tiab.abnr and inplnr IN (3797886)),0 ,NULL , 1, tior.tigilopnr, 'N/A') tigilopnr
FROM tis.tiab
JOIN tis.tior on tiab.abnr = tior.abnr
WHERE tior.inplnr IN (3797886)
ORDER BY tiab.ABNR )
ORDER BY abnr;
It returns the following:
14684940 Pizza Station Inc The Lafayette 26170 St Marys 304 684-2411
15123161 Chris Test 554 Easy St n 43333 Columbus 614 555-5555
15123162 Chris Test2 5556 Easy St 43333 Columbus 614 555-5151 2553304 --> keep this one
15123162 Chris Test2 5556 Easy St 43333 Columbus 614 555-5151 -- not show this
I have tried several different things as well as looking through the forums but have not found anything that will only give me unique records based only on the first column. This query works fine as long as there
are not 2 records returned with column1 being identical.
Final results should look like this:
14684940 Pizza Station Inc The Lafayette 26170 St Marys 304 684-2411
15123161 Chris Test 554 Easy St n 43333 Columbus 614 555-5555
15123162 Chris Test2 5556 Easy St 43333 Columbus 614 555-5151 2553304
Thanks in advance for the assistance.
Hello,
Try:
SELECT abnr, namn, ADR, boxpnr, boxort,RIKTNR, TELNR,tigilopnr
FROM (
SELECT tiab.abnr abnr, tiab.namn namn, (CAST(tiab.GATUNR||' '||tiab.gata AS VARCHAR2(254))) ADR, tiab.boxpnr boxpnr, tiab.boxort boxort,
(CAST(tiab.RIKTNRDISPLAY AS VARCHAR2(254))) RIKTNR, (CAST(tiab.TELNRDISPLAY AS VARCHAR2(254))) TELNR,
DECODE((select count(tior.tigilopnr) from tis.tior where abnr = tiab.abnr and inplnr IN (3797886)),0 ,NULL , 1, tior.tigilopnr, 'N/A') tigilopnr,
ROW_NUMBER () OVER (PARTITION BY tiab.abnr ORDER BY (CAST(tiab.TELNRDISPLAY AS VARCHAR2(254))) NULLS LAST) row_num
FROM tis.tiab
JOIN tis.tior on tiab.abnr = tior.abnr
WHERE tior.inplnr IN (3797886))
WHERE row_num <= 1
ORDER BY abnr;Or, with your current query:
SELECT abnr, namn, ADR, boxpnr, boxort,RIKTNR, TELNR,tigilopnr
FROM (
SELECT distinct tiab.abnr abnr, tiab.namn namn, (CAST(tiab.GATUNR||' '||tiab.gata AS VARCHAR2(254))) ADR, tiab.boxpnr boxpnr, tiab.boxort boxort,
(CAST(tiab.RIKTNRDISPLAY AS VARCHAR2(254))) RIKTNR, (CAST(tiab.TELNRDISPLAY AS VARCHAR2(254))) TELNR,
DECODE((select count(tior.tigilopnr) from tis.tior where abnr = tiab.abnr and inplnr IN (3797886)),0 ,NULL , 1, tior.tigilopnr, 'N/A') tigilopnr,
ROW_NUMBER () OVER (PARTITION BY tiab.abnr ORDER BY (CAST(tiab.TELNRDISPLAY AS VARCHAR2(254))) NULLS LAST) row_num
FROM tis.tiab
JOIN tis.tior on tiab.abnr = tior.abnr
WHERE tior.inplnr IN (3797886))
WHERE row_num <= 1
ORDER BY abnr;
Similar Messages
-
Need to remove duplicate rows from a table
Hi Gurus ,
I am using oracle 11.2.0.3 .
SQL> desc osstage.S_EVT_ACT_X;
Name Null? Type
ROW_ID NOT NULL VARCHAR2(15 CHAR)
LAST_UPD NOT NULL DATE
PAR_ROW_ID NOT NULL VARCHAR2(15 CHAR)
ATTRIB_17 NUMBER(22,7)
ATTRIB_26 DATE
ATTRIB_02 VARCHAR2(100 CHAR)
PROCESS_TIMESTAMP TIMESTAMP(6);
now when i give the below command it gives the error as someone has disabled the constraint accidently .
alter table s_evt_act_x enable constraint S_EVT_ACT_X_P1;
Error starting at line 3 in command:
alter table s_evt_act_x enable constraint S_EVT_ACT_X_P1
Error report:
SQL Error: ORA-02437: cannot validate (OSSTAGE.S_EVT_ACT_X_P1) - primary key violated
02437. 00000 - "cannot validate (%s.%s) - primary key violated"
*Cause: attempted to validate a primary key with duplicate values or null
values.
*Action: remove the duplicates and null values before enabling a primary
key.
Can you please guide me with this issue .Please refer
Script: Deleting Duplicate Rows from a Table (Doc ID 31413.1)
How to Find or Delete Duplicate Rows in a Table (Doc ID 1004425.6) -
First attempt to remove duplicate rows from a table...
I have seen many people asking for a way to remove duplicate rows from data. I made up a fairly simple script. It adds a column to the table with the cell selected in it, and adds the concatenation of the data to the left into that new column. then it reads that into a list, and walks through that list to find any that are listed twice. Any that are it marks for DELETE.
It then walks through to find each one marked for delete and removes them (you must go from bottom to top to do this, otherwise your row markings for delete don't match up to the original rows anymore). Last is to delete the column we added.
tell application "Numbers"
activate
tell document 1
-- DETERMINE THE CURRENT SHEET
set currentsheetindex to 0
repeat with i from 1 to the count of sheets
tell sheet i
set x to the count of (tables whose selection range is not missing value)
end tell
if x is not 0 then
set the currentsheetindex to i
exit repeat
end if
end repeat
if the currentsheetindex is 0 then error "No sheet has a selected table."
-- GET THE TABLE WITH CELLS
tell sheet currentsheetindex
set the current_table to the first table whose selection range is not missing value
end tell
end tell
log current_table
tell current_table
set list1 to {}
add column after column (count of columns)
set z to (count of columns)
repeat with j from 1 to (count of rows)
set m to ""
repeat with i from 1 to (z - 1)
set m to m & value of (cell i of row j)
end repeat
set value of cell z of row j to m
end repeat
set MyRange to value of every cell of column z
repeat with i from 1 to (count of items of MyRange)
set n to item i of MyRange
if n is in list1 then
set end of list1 to "Delete"
else
set end of list1 to n
end if
end repeat
repeat with i from (count of items of list1) to 1 by -1
set n to item i of list1
if n = "Delete" then remove row i
end repeat
remove column z
end tell
end tell
Let me know how it works for y'all, it worked good on my machine, but I know localization is causing errors sometimes when I post things.
Thanks,
Jason
Message was edited by: jaxjasonHi jason
I hope that with the added comments it will be clear.
Ask if something is always opaque.
set {current_Range, current_table, current_Sheet, current_Doc} to my getSelection()
tell application "Numbers09"
tell document current_Doc to tell sheet current_Sheet to tell table current_table
set list1 to {}
add column after column (count of columns)
set z to (count of columns)
repeat with j from 1 to (count of rows)
set m to ""
tell row j
repeat with i from 1 to (z - 1)
set m to m & value of cell i
end repeat
set value of cell z to m
end tell
end repeat
set theRange to value of every cell of column z
repeat with i from (count of items of theRange) to 1 by -1
(* As I scan the table backwards (starting from the bottom row),
I may remove a row immediately when I discover that it is a duplicate *)
set n to item i of theRange
if n is in list1 then
remove row i
else
set end of list1 to n
end if
end repeat
remove column z
end tell
end tell
--=====
on getSelection()
local _, theRange, theTable, theSheet, theDoc, errMsg, errNum
tell application "Numbers09" to tell document 1
set theSheet to ""
repeat with i from 1 to the count of sheets
tell sheet i
set x to the count of tables
if x > 0 then
repeat with y from 1 to x
(* Open a trap to catch the selection range.
The structure of this item
«class
can't be coerced as text.
So, when the instruction (selection range of table y) as text
receive 'missing value' it behaves correctly and the lup continue.
But, when it receive THE true selection range, it generates an error
whose message is errMsg and number is errNum.
We grab them just after the on error instruction *)
try
(selection range of table y) as text
on error errMsg number errNum (*
As we reached THE selection range, we are here.
We grab the errMsg here. In French it looks like:
"Impossible de transformer «class
The handler cuts it in pieces using quots as delimiters.
item 1 (_) "Impossible de transformer «class » "
item 2 (theRange) "A2:M25"
item 3 (_) " of «class NmTb» "
item 4 (theTable) "Tableau 1"
item 5 (_) " of «class NmSh» "
item 6 (theSheet) "Feuille 1"
item 7 (_) " of document "
item 8 (theDoc) "Sans titre"
item 9 ( I drop it ) " of application "
item 10 ( I drop it ) "Numbers"
item 11 (I drop it ) " en type string."
I grab these items in the list
{_, theRange, _, theTable, _, theSheet, _, theDoc}
Yes, underscore is a valid name of variable.
I often uses it when I want to drop something.
An alternate way would be to code:
set ll to my decoupe(errMsg, quote)
set theRange to item 2 of ll
set theTable to item 4 of ll
set theSheet to item 8 of ll
set theDoc to item 10 of ll
it works exactly the same but it's not so elegant.
set {_, theRange, _, theTable, _, theSheet, _, theDoc} to my decoupe(errMsg, quote)
exit repeat (*
as we grabbed the interesting datas, we exit the lup indexed by y.*)
end try
end repeat -- y
if theSheet > "" then exit repeat (*
If we are here after grabbing the datas, theSheet is not "" so we exit the lup indexed by i *)
end if
end tell -- sheet
end repeat -- i
(* We may arrive here with two kinds of results.
if we grabbed a selection, theSheet is something like "Feuille 1"
if we didn't grabbed a selection, theSheet is the "" defined on entry
and we generate an error which is not trapped so it stops the program *)
if theSheet = "" then error "No sheet has a selected table."
end tell -- document
(* Now, we send to the caller the interesting datas :
theRange "A2:M25"
theTable "Tableau 1"
theSheet "Feuille 1"
theDoc "Sans titre" *)
return {theRange, theTable, theSheet, theDoc}
end getSelection
--=====
on decoupe(t, d)
local l
set AppleScript's text item delimiters to d (*
Cut the text t in pieces using d as delimiter *)
set l to text items of t
set AppleScript's text item delimiters to "" (*
Resets the delimiters to the standard value. *)
(* Send the list to the caller *)
return l
end decoupe
--=====
Have fun
And if it's not clear enough, you may ask for more explanations.
Yvan KOENIG (from FRANCE mardi 27 janvier 2009 21:49:19) -
Removing duplicate rows from SELECT
Hi, I was wondering if there was any way to remove duplicate rows from a select statement.
My table looks like this:
CREATE TABLE CUS_ID_TO_PC_ID (
CUSTOMER_ID VARCHAR2 (10) NOT NULL,
PC_ID VARCHAR2 (25) NOT NULL,
PASSWORD VARCHAR2 (25) NOT NULL,
REG_DATE DATE,
PRODUCT_DESC VARCHAR2 (25),
EXPIRE_DATE DATE,
SERIAL_NBR VARCHAR2 (12),
LDAP_USER VARCHAR2 (200),
COMMENTS VARCHAR2 (2000),
PC_ID_5_4 VARCHAR2 (25),
PC_ID_6_0 VARCHAR2 (25),
PASSWORD_5_4 VARCHAR2 (25),
PASSWORD_6_0 VARCHAR2 (25),
PC_ID_6_1 VARCHAR2 (25),
PASSWORD_6_1 VARCHAR2 (25),
OPERATING_SYSTEM VARCHAR2 (20),
STATUS VARCHAR2 (1)
Basically, I want to retrieve all columns from the table but remove all duplicate variations of
the pc_id/serial_nbr combinations.
For example, given this data:
PC_ID SERIAL_NBR CUSTOMER_NO
1234567 AAA C345
1234567 AAA C567
3333333 BBB C456
only the 1st and 3rd rows would be returned.
Any ideas?Try something like this:
select * from your_table yt
where rowid in (select max(rowid)
from your_tabel yt2
where yt2.pc_id = yt.pc_id
and yt2.serial_nbr = yt.serial_nbr); -
I have two tables MEMBER_ADRESS and MEMBER_ORDER. The MEMBER_ADRESS has duplicate rows in it based on MEMBER_ID and MATCH_VALUE. These duplicate ADDRESS_IDs were used in MEMBER_ORDER. I need to remove the duplicates from MEMBER_ADRESS making sure I keep the one with PRIMARY_FLAG = ‘Y’ and update MEMBER_ORDER.ADDRESS_ID to the MEMBER_ADRESS.ADDRESS_ID that I kept.
I am on 11gR1
Thanks for the help.
CREATE TABLE MEMBER_ADRESS
ADDRESS_ID NUMBER,
MEMBER_ID NUMBER,
ADDRESS_1 VARCHAR2(30 BYTE),
ADDRESS_2 VARCHAR2(30 BYTE),
CITY VARCHAR2(25 BYTE),
STATE VARCHAR2(2 BYTE),
ZIPCODE VARCHAR2(10 BYTE),
CREATION_DATE DATE,
LAST_UPDATE_DATE DATE,
PRIMARY_FLAG CHAR(1 BYTE),
ADDITIONAL_COMPANY_INFO VARCHAR2(40 BYTE),
MATCH_VALUE NUMBER(38) GENERATED ALWAYS AS (TO_NUMBER( REGEXP_REPLACE ("ADDITIONAL_COMPANY_INFO"||"ADDRESS_1"||"ADDRESS_2"||"CITY"||"STATE"||"ZIPCODE",'[^[:digit:]]')))
Insert into MEMBER_ADRESS
(ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
Values
(200, 30, '11 Hourse Rd.',
'58754', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:34:10', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 1158754);
Insert into MEMBER_ADRESS
(ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
Values
(230, 12, '101 Banks St',
'58487', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:35:42', 'MM/DD/YYYY HH24:MI:SS'), 'N', 10158487);
Insert into MEMBER_ADRESS
(ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
Values
(232, 12, '101 Banks Street',
'58487', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:41:15', 'MM/DD/YYYY HH24:MI:SS'), 'N', 10158487);
Insert into MEMBER_ADRESS
(ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
Values
(228, 12, '101 Banks St.',
'58487', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:38:19', 'MM/DD/YYYY HH24:MI:SS'), 'N', 10158487);
Insert into MEMBER_ADRESS
(ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
Values
(221, 25, '881 Green Road',
'58887', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:34:18', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 88158887);
Insert into MEMBER_ADRESS
(ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
Values
(278, 28, '2811 Brown St.',
'58224', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:36:11', 'MM/DD/YYYY HH24:MI:SS'), 'N', 281158224);
Insert into MEMBER_ADRESS
(ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
Values
(280, 28, '2811 Brown Street',
'58224', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:45:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 281158224);
Insert into MEMBER_ADRESS
(ADDRESS_ID, MEMBER_ID, ADDRESS_1, ADDRESS_2, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
Values
(300, 12, '3421 West North Street', 'x',
'58488', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:42:04', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 342158488);
COMMIT;
CREATE TABLE MEMBER_ORDER
ORDER_ID NUMBER,
ADDRESS_ID NUMBER,
MEMBER_ID NUMBER
Insert into MEMBER_ORDER
(ORDER_ID, ADDRESS_ID, MEMBER_ID)
Values
(3, 200, 30);
Insert into MEMBER_ORDER
(ORDER_ID, ADDRESS_ID, MEMBER_ID)
Values
(4, 230, 12);
Insert into MEMBER_ORDER
(ORDER_ID, ADDRESS_ID, MEMBER_ID)
Values
(5, 228, 12);
Insert into MEMBER_ORDER
(ORDER_ID, ADDRESS_ID, MEMBER_ID)
Values
(6, 278, 28);
Insert into MEMBER_ORDER
(ORDER_ID, ADDRESS_ID, MEMBER_ID)
Values
(8, 278, 28);
Insert into MEMBER_ORDER
(ORDER_ID, ADDRESS_ID, MEMBER_ID)
Values
(10, 230, 12);
COMMIT;Hi John;
Sorry I missed your post. Yes sorry about the flag. Please take a look as these before and after sets. I hope this helps. I should have posted this in the begining.
MEMBER_ORDER (BEFORE)
ORDER_ID ADDRESS_ID MEMEBER_ID
4 228 12
10 230 12
5 230 12
11 232 12
12 300 12
8 278 28
6 278 28
3 200 30
MEMBER_ORDER (AFTER)
ORDER_ID ADDRESS_ID MEMEBER_ID
4 232 12
10 232 12
5 232 12
11 232 12
12 300 12
8 280 28
6 280 28
3 200 30
MEMBER_ADDRESS (BEFORE)
ADDRESS_ID MEMBER_ID ADDRESS_1 CREATION_DATE LAST_UPDATE_DATE PRIMARY_FLAG MATCH_VALUE
228 12 101 Banks St. 8/11/2000 10:56:25 AM 8/12/2005 10:38:19 AM N 10158487
230 12 101 Banks St 8/11/2000 10:56:25 AM 8/12/2006 10:35:42 AM N 10158487
232 12 101 Banks Street 8/11/2000 10:56:25 AM 8/12/2007 10:41:15 AM N 10158487
300 12 3421 West North Street 8/11/2000 10:56:25 AM 8/12/2011 10:42:04 AM Y 342158488
221 25 881 Green Road 8/11/2000 10:56:25 AM 8/12/2011 10:34:18 AM Y 88158887
278 28 2811 Brown St. 8/11/2000 10:56:25 AM 8/12/2006 10:36:11 AM N 281158224
280 28 2811 Brown Street 8/11/2000 10:56:25 AM 8/12/2011 10:45:00 AM Y 281158224
200 30 11 Hourse Rd. 8/11/2000 10:56:25 AM 8/12/2005 10:34:10 AM Y 1158754
MEMBER_ADDRESS (AFTER)
ADDRESS_ID MEMBER_ID ADDRESS_1 CREATION_DATE LAST_UPDATE_DATE PRIMARY_FLAG MATCH_VALUE
232 12 101 Banks Street 8/11/2000 10:56:25 AM 8/12/2007 10:41:15 AM N 10158487
300 12 3421 West North Street 8/11/2000 10:56:25 AM 8/12/2011 10:42:04 AM Y 342158488
221 25 881 Green Road 8/11/2000 10:56:25 AM 8/12/2011 10:34:18 AM Y 88158887
280 28 2811 Brown Street 8/11/2000 10:56:25 AM 8/12/2011 10:45:00 AM Y 281158224
200 30 11 Hourse Rd. 8/11/2000 10:56:25 AM 8/12/2005 10:34:10 AM Y 1158754 -
Removing Duplicate Rows from resultSet
I have a query pulling data from 5 tables in 12 columns. I have rows where all of the data is duplicated with the exception of one date column. How would I go about deleting rows that are duplicates with the exception of this one column? I still need to pull the date from the date column with the Max(date).
i.e.
Bob Smith 1 2 3 4 12-Jul-2006
Bob Smith 1 2 3 4 02-Aug-2006
Bob Smith 1 2 3 4 21-Jan-2006
Form this resultset I only want one row
Thanks.this example might be of help.
SQL> select * from employees;
YEAR EM NAME PO
2001 02 Scott 91
2001 02 Scott 01
2001 02 Scott 07
2001 03 Tom 81
2001 03 Tom 84
2001 03 Tom 87
6 rows selected.
SQL> select year, empcode, name, position,
2 row_number() over (partition by year, empcode, name
3 order by year, empcode, name, position) as rn
4 from employees;
YEAR EM NAME PO RN
2001 02 Scott 01 1
2001 02 Scott 07 2
2001 02 Scott 91 3
2001 03 Tom 81 1
2001 03 Tom 84 2
2001 03 Tom 87 3
6 rows selected.
SQL> Select year, empcode, name, position
2 From (Select year, empcode, name, position,
3 row_number() over (partition by year, empcode, name
4 order by year, empcode, name, position) as rn
5 From employees) emp
6 Where rn = 1;
YEAR EM NAME PO
2001 02 Scott 01
2001 03 Tom 81
SQL> Delete From employees
2 Where rowid in (Select emp.rid
3 From (Select year, empcode, name, position,
4 rowid as rid,
5 row_number() over (partition by year, empcode, name
6 order by year, empcode, name, position) as rn
7 From employees) emp
8 Where emp.rn > 1);
4 rows deleted.
SQL> select * from employees;
YEAR EM NAME PO
2001 02 Scott 01
2001 03 Tom 81
SQL> if you can post a sample create tables and data it will help us provide you a some solutions. -
Removing a row from SQL query results when there is a duplicate hostname
I have a query created for a software usage report in SCCM. When there are multiple versions of the same software (Acrobat) installed on the same machine, I will receive duplicate results for the same machine. For example, it will come back with Acrobat
9 and another Acrobat 10 for HOSTNAME1. However, only Acrobat 10 has a usage count. Is it possible to delete the row for Acrobat that has a software usage count of "0/null" if there is another Acrobat results showing up that actually has a usage
count? Let me know if I need to clarify. Any suggestions would be appreciated.It is more complicated than doing just "Where usage count >0 and usage is not NULL"
because I still want results that have a 0 usage count. I just don't want to have duplicate machines show up for the same software IF one of them returns a usage count of 0.
SELECT DISTINCT
abc.SECTOR
,abc.BA
,abc.SITE
,abc.HOSTNAME as 'Name0'
,rs.ResourceID
,CASE
WHEN mf.OriginalFileName = 'dwrcc.exe' THEN 'DameWare'
WHEN mf.OriginalFileName = 'matlab.exe' THEN 'MathWorks'
WHEN mf.OriginalFileName IN ('encoder.exe','expressionweb.exe','exprwd.exe','mappoint.exe','winproj.exe','visio.exe','devenv.exe','VBExpress.exe','VCExpress.exe','VCSExpress.exe','VWDExpress.exe','excel.exe','groove.exe','infopath.exe','msaccess.exe','mspub.exe','onenote.exe','outlook.exe','powerpnt.exe','winword.exe','communicator.exe')
THEN 'Microsoft'
WHEN mf.OriginalFileName IN ('acrobat.exe','Acrobat Elements.exe','AfterFX.exe','Audition.Exe','Adobe Audition.Exe','AdobeCaptivate.exe','CFReportBuilder.exe','Coldfusion.Exe','Contribute.exe','director.exe','Projector.exe','dreamweaver.exe','Adobe
Encore.exe','Adobe Encore Dvd.Exe','Encoredvd.Exe','Fireworks.exe','FlashBuilder4.exe','flash.exe','Flex Builder.exe','FlexBuilder.exe','Framemaker.Exe','framemaker+sgml.exe','illustrator.exe','HomeSite+.exe','homesite4.exe','homesite45.exe','Homesite5.exe','InDesign.exe','Lightroom.exe','Adobe
OnLocation.exe','Pm65.Exe','Pm70.Exe','pm.exe','pm4.exe','pm5.exe','pm6.exe','photoshop.exe','Photosle.exe','Photoshopelementsorganizer.Exe','Photoshopelementseditor.Exe','photoshp.exe','Lightroom.exe','Adobe Premiere Elements.Exe','Adobe Premiere Elements
8.0.Exe','Adobe Premiere Elements 10.Exe','Adobe Premiere Elements 9.Exe','Adobe Premiere Elements 7.0.exe','Premiere.Exe','Adobe Premiere Pro.Exe','Adobe-Pr-Vc.Exe','Robohelp.Exe','robodemo.exe','roboinfo.exe','Adobe Soundbooth CS5.exe','Adobe Soundbooth
CS4.exe','Adobe Soundbooth CS3.exe','Adobe Media Encoder.exe','speedgrade.exe','adobe prelude.exe') THEN 'Adobe'
ELSE 'OTHER'
END as 'Publisher'
,(CASE mf.OriginalFileName
WHEN 'acrobat.exe' THEN 'Acrobat'
WHEN 'Acrobat Elements.exe' THEN 'Acrobat Elements'
WHEN 'AfterFX.exe' THEN 'After Effects'
WHEN 'Audition.exe' THEN 'Audition'
WHEN 'Adobe Audition.exe' THEN 'Audition'
WHEN 'AdobeCaptivate.exe' THEN 'Captivate'
WHEN 'CFReportBuilder.exe' THEN 'Coldfusion Builder'
WHEN 'Coldfusion.exe' THEN 'Coldfusion Standard'
WHEN 'Contribute.exe' THEN 'Contribute'
WHEN 'dwrcc.exe' THEN 'DameWare Mini Remote Control'
WHEN 'director.exe' THEN 'Director'
WHEN 'Projector.exe' THEN 'Director'
WHEN 'dreamweaver.exe' THEN 'Dreamweaver'
WHEN 'Adobe Encore.exe' THEN 'Encore'
WHEN 'Adobe Encore Dvd.exe' THEN 'Encore'
WHEN 'Encoredvd.exe' THEN 'Encore'
WHEN 'encoder.exe' THEN 'Expression'
WHEN 'expressionweb.exe' THEN 'Expression'
WHEN 'exprwd.exe' THEN 'Expression'
WHEN 'Fireworks.exe' THEN 'Fireworks'
WHEN 'FlashBuilder4.exe' THEN 'Flash Builder'
WHEN 'flash.exe' THEN 'Flash Pro'
WHEN 'Flex Builder.exe' THEN 'FlexBuilder'
WHEN 'FlexBuilder.exe' THEN 'FlexBuilder'
WHEN 'Framemaker.exe' THEN 'FrameMaker'
WHEN 'framemaker+sgml.exe' THEN 'FrameMaker'
WHEN 'HomeSite+.exe' THEN 'Homesite'
WHEN 'homesite4.exe' THEN 'Homesite'
WHEN 'homesite45.exe' THEN 'Homesite'
WHEN 'Homesite5.exe' THEN 'Homesite'
WHEN 'illustrator.exe' THEN 'Illustrator'
WHEN 'InDesign.exe' THEN 'InDesign'
WHEN 'Lightroom.exe' THEN 'Lightroom'
WHEN 'mappoint.exe' THEN 'MapPoint'
WHEN 'Adobe Media Encoder.exe' THEN 'Media Encoder'
WHEN 'Adobe OnLocation.exe' THEN 'OnLocation'
WHEN 'Pm65.exe' THEN 'PageMaker'
WHEN 'Pm70.exe' THEN 'PageMaker'
WHEN 'pm.exe' THEN 'PageMaker'
WHEN 'pm4.exe' THEN 'PageMaker'
WHEN 'pm5.exe' THEN 'PageMaker'
WHEN 'pm6.exe' THEN 'PageMaker'
WHEN 'photoshop.exe' THEN 'Photoshop'
WHEN 'Photosle.exe' THEN 'Photoshop'
WHEN 'Photoshopelementsorganizer.exe' THEN 'Photoshop Elements'
WHEN 'Photoshopelementseditor.exe' THEN 'Photoshop Elements'
WHEN 'photoshp.exe' THEN 'Photoshop Elements'
WHEN 'Lightroom.exe' THEN 'Photoshop Lightroom'
WHEN 'adobe prelude.exe' THEN 'Prelude'
WHEN 'Adobe Premiere Elements.exe' THEN 'Premiere Elements'
WHEN 'Adobe Premiere Elements 8.0.exe' THEN 'Premiere Elements'
WHEN 'Adobe Premiere Elements 10.exe' THEN 'Premiere Elements'
WHEN 'Adobe Premiere Elements 9.exe' THEN 'Premiere Elements'
WHEN 'Adobe Premiere Elements 7.0.exe' THEN 'Premiere Elements'
WHEN 'Premiere.exe' THEN 'Premiere Pro'
WHEN 'Adobe Premiere Pro.exe' THEN 'Premiere Pro'
WHEN 'Adobe-Pr-Vc.exe' THEN 'Presenter'
WHEN 'winproj.exe' THEN 'Project'
WHEN 'Robohelp.exe' THEN 'RoboHelp'
WHEN 'robodemo.exe' THEN 'RoboHelp'
WHEN 'roboinfo.exe' THEN 'RoboHelp'
WHEN 'Adobe Soundbooth CS5.exe' THEN 'Soundbooth'
WHEN 'Adobe Soundbooth CS4.exe' THEN 'Soundbooth'
WHEN 'Adobe Soundbooth CS3.exe' THEN 'Soundbooth'
WHEN 'speedgrade.exe' THEN 'Speedgrade'
WHEN 'visio.exe' THEN 'Visio'
WHEN 'devenv.exe' THEN 'Visual Studio'
WHEN 'VBExpress.exe' THEN 'Visual Studio'
WHEN 'VCExpress.exe' THEN 'Visual Studio'
WHEN 'VCSExpress.exe' THEN 'Visual Studio'
WHEN 'VWDExpress.exe' THEN 'Visual Studio'
WHEN 'WinWord.exe' THEN 'Word'
WHEN 'matlab.exe' THEN 'MATLAB'
ELSE mf.OriginalFileName
END) as 'ProductName'
,mf.OriginalFileName
,sf.FileDescription
,CASE
WHEN sf.FilePath like '%acrobat%' and sf.FileVersion != '' THEN left(sf.FileVersion,patindex('%.%',sf.FileVersion)-1)
ELSE sf.FileVersion
END AS 'FileVersion'
,sf.FilePath
,mf.MeteredFileID
,ISNULL(mus.UsageTime, '') as 'USAGETIME'
,ISNULL(mus.UsageCount, '') as 'USAGECOUNT'
,mus.LastUsage
--,ISNULL(CONVERT(VARCHAR,mus.LastUsage,21),'') as 'Last Used'
,CASE
WHEN mus.LastUsage IS NULL and
sf.FilePath like '%\Program Files\Hewlett-Packard\%'
or sf.FilePath like '_:\Windows\%'
or sf.FilePath like '% old %'
or sf.FilePath like '%[_]old[_]%'
or sf.FilePath like '%backup%'
or sf.FilePath like '_:\Data\%'
or sf.FilePath like 'C:\Users\%'
or sf.FilePath like 'C:\Documents and Settings\%'
or (sf.FileName = 'acrobat.exe' and sf.FileDescription IS NULL)
THEN 'FALSE'
ELSE 'TRUE'
END as 'VALID'
,ISNULL(ui.UserName,scum.TopConsoleUser0) as 'PrimaryUser'
FROM
v_MeteredFiles mf
INNER JOIN v_GS_SoftwareFile sf on mf.MeteredFileID = sf.FileID
--LEFT JOIN v_SoftwareFile sfi on sfi.FileID = sf.FileID
LEFT JOIN v_R_System rs on sf.ResourceID = rs.ResourceID and rs.Obsolete0 = 0 and rs.Active0 = 1
LEFT JOIN v_CH_ClientSummary ch on ch.ResourceID = rs.ResourceID
INNER JOIN [CUSTOM].[dbo].[ABC_SITES] abc on rs.Name0 = abc.HOSTNAME and abc.SERV_FL = 'N'
LEFT JOIN (
SELECT ResourceID,FileID,SUM(UsageCount) as 'UsageCount',MAX(MeteredUserID) as 'UserID',SUM(UsageTime) as 'UsageTime',MAX(LastUsage) as 'LastUsage'
FROM v_MonthlyUsageSummary
GROUP BY ResourceID,FileID
) mus on mus.ResourceID = sf.ResourceID and mus.FileID = mf.MeteredFileID
LEFT JOIN v_Users ui on ui.UserID = mus.UserID
LEFT JOIN v_GS_SYSTEM_CONSOLE_USAGE_MAXGROUP scum on scum.ResourceID = rs.ResourceID
WHERE
(ch.LastActiveTime >= GETDATE()-30 or bae.LOGON_TMSP >= GETDATE()-30)
and mf.OriginalFileName != 'WinWord.exe'
--Exclude files in Recycle Bin
and sf.FilePath not like '_:\$Recycle.Bin%'
--Exclude invalid flash FileID's:
and sf.FileID not in ('216172782114109353','216172782113863960','216172782113863969','216172782114336737','216172782114337853','216172782114009539','216172782114088205','216172782114148960','216172782114088174','216172782114109319','216172782113854316','216172782114045303','216172782114103331','216172782114318673','216172782113997536','216172782114103319','216172782114035585','216172782114035580','288230376151905593','288230376152414835','288230376152326390','288230376152414762','288230376152752371','288230376152238194','288230376151864114','288230376152221470','288230376152194417','288230376152452591','288230376152433530','288230376151826881','288230376151905590','288230376151993886','288230376152142718','288230376151766967','288230376151949862','288230376151870700','288230376151805491','288230376151796019','288230376152041232','288230376152068486','288230376152330596','288230376151982279','288230376151982277','288230376152126901','288230376151864098','288230376152129697','288230376152055728','216172782113836986','288230376152068474','288230376152068500','288230376151754145','288230376152241787','216172782113974892','288230376152107352','288230376152049272','288230376152367258','288230376152014270','288230376152423348','288230376151777614','288230376152137355','288230376152699042','288230376151777252','288230376152025890','288230376152688217','216172782113850093','216172782113850201','216172782114478326','216172782114139161','216172782113976965','216172782114084839','216172782114084848','288230376151766956','288230376152068464','288230376151766948','288230376152068455','288230376151903237','288230376151857402','288230376151933218','216172782113888320','216172782113867157','216172782113798401','216172782113884867')
and sf.FileDescription not like '%PackageForTheWeb%'
and sf.FileDescription not like '%Projector%'
and sf.FileDescription not like '%Adobe Reader%'
and sf.FileDescription not like '%Netopsystems%'
and abc.SECTOR in (@Sector)
and abc.BA in (@Business_Area)
and abc.SITE in (@Site)
and (CASE mf.OriginalFileName
WHEN 'acrobat.exe' THEN 'Acrobat'
WHEN 'Acrobat Elements.exe' THEN 'Acrobat Elements'
WHEN 'AfterFX.exe' THEN 'After Effects'
WHEN 'Audition.exe' THEN 'Audition'
WHEN 'Adobe Audition.exe' THEN 'Audition'
WHEN 'AdobeCaptivate.exe' THEN 'Captivate'
WHEN 'CFReportBuilder.exe' THEN 'Coldfusion Builder'
WHEN 'Coldfusion.exe' THEN 'Coldfusion Standard'
WHEN 'Contribute.exe' THEN 'Contribute'
WHEN 'dwrcc.exe' THEN 'DameWare Mini Remote Control'
WHEN 'director.exe' THEN 'Director'
WHEN 'Projector.exe' THEN 'Director'
WHEN 'dreamweaver.exe' THEN 'Dreamweaver'
WHEN 'Adobe Encore.exe' THEN 'Encore'
WHEN 'Adobe Encore Dvd.exe' THEN 'Encore'
WHEN 'Encoredvd.exe' THEN 'Encore'
WHEN 'encoder.exe' THEN 'Expression'
WHEN 'expressionweb.exe' THEN 'Expression'
WHEN 'exprwd.exe' THEN 'Expression'
WHEN 'Fireworks.exe' THEN 'Fireworks'
WHEN 'FlashBuilder4.exe' THEN 'Flash Builder'
WHEN 'flash.exe' THEN 'Flash Pro'
WHEN 'Flex Builder.exe' THEN 'FlexBuilder'
WHEN 'FlexBuilder.exe' THEN 'FlexBuilder'
WHEN 'Framemaker.exe' THEN 'FrameMaker'
WHEN 'framemaker+sgml.exe' THEN 'FrameMaker'
WHEN 'HomeSite+.exe' THEN 'Homesite'
WHEN 'homesite4.exe' THEN 'Homesite'
WHEN 'homesite45.exe' THEN 'Homesite'
WHEN 'Homesite5.exe' THEN 'Homesite'
WHEN 'illustrator.exe' THEN 'Illustrator'
WHEN 'InDesign.exe' THEN 'InDesign'
WHEN 'Lightroom.exe' THEN 'Lightroom'
WHEN 'mappoint.exe' THEN 'MapPoint'
WHEN 'Adobe Media Encoder.exe' THEN 'Media Encoder'
WHEN 'Adobe OnLocation.exe' THEN 'OnLocation'
WHEN 'Pm65.exe' THEN 'PageMaker'
WHEN 'Pm70.exe' THEN 'PageMaker'
WHEN 'pm.exe' THEN 'PageMaker'
WHEN 'pm4.exe' THEN 'PageMaker'
WHEN 'pm5.exe' THEN 'PageMaker'
WHEN 'pm6.exe' THEN 'PageMaker'
WHEN 'photoshop.exe' THEN 'Photoshop'
WHEN 'Photosle.exe' THEN 'Photoshop'
WHEN 'Photoshopelementsorganizer.exe' THEN 'Photoshop Elements'
WHEN 'Photoshopelementseditor.exe' THEN 'Photoshop Elements'
WHEN 'photoshp.exe' THEN 'Photoshop Elements'
WHEN 'Lightroom.exe' THEN 'Photoshop Lightroom'
WHEN 'adobe prelude.exe' THEN 'Prelude'
WHEN 'Adobe Premiere Elements.exe' THEN 'Premiere Elements'
WHEN 'Adobe Premiere Elements 8.0.exe' THEN 'Premiere Elements'
WHEN 'Adobe Premiere Elements 10.exe' THEN 'Premiere Elements'
WHEN 'Adobe Premiere Elements 9.exe' THEN 'Premiere Elements'
WHEN 'Adobe Premiere Elements 7.0.exe' THEN 'Premiere Elements'
WHEN 'Premiere.exe' THEN 'Premiere Pro'
WHEN 'Adobe Premiere Pro.exe' THEN 'Premiere Pro'
WHEN 'Adobe-Pr-Vc.exe' THEN 'Presenter'
WHEN 'winproj.exe' THEN 'Project'
WHEN 'Robohelp.exe' THEN 'RoboHelp'
WHEN 'robodemo.exe' THEN 'RoboHelp'
WHEN 'roboinfo.exe' THEN 'RoboHelp'
WHEN 'Adobe Soundbooth CS5.exe' THEN 'Soundbooth'
WHEN 'Adobe Soundbooth CS4.exe' THEN 'Soundbooth'
WHEN 'Adobe Soundbooth CS3.exe' THEN 'Soundbooth'
WHEN 'speedgrade.exe' THEN 'Speedgrade'
WHEN 'visio.exe' THEN 'Visio'
WHEN 'devenv.exe' THEN 'Visual Studio'
WHEN 'VBExpress.exe' THEN 'Visual Studio'
WHEN 'VCExpress.exe' THEN 'Visual Studio'
WHEN 'VCSExpress.exe' THEN 'Visual Studio'
WHEN 'VWDExpress.exe' THEN 'Visual Studio'
WHEN 'WinWord.exe' THEN 'Word'
WHEN 'matlab.exe' THEN 'Matlab'
ELSE mf.OriginalFileName
END) IN (@MeteredProduct)
ORDER BY
abc.SECTOR
,abc.BA
,abc.SITE
,abc.HOSTNAME -
Remove Duplicate Rows from Left Outer Join
Hi All,
I am new to Oracle..I have two tables as follow:
TableA(EmpID, Empname)
TableB(EmpID, DeptID, DeptName). A employee can work in multiple dept.
table A has 1 row as EmpID 1 and TableB has two rows for EmpID 1.
I have a search page which takes dept ID as parameter and return employee name...Dept ID is not mandatory feld for Search. If DeptID is passed it should return the employee who belongs to that Dept otherwise it should return 1 employee..
Now I have used as follow:
:IN_DEPTID is passed as parameter
Select EmpName from TableA Left Join tableB on a.EmpID = B.EmpID
WHERE
CASE WHEN :IN_DEPTID IS NULL
IN_DEPTID IS NULL
ELSE|
DEPTID = :IN_DEPTID
Now problem is when Dept ID is passed it correctly returns a row but if no deptid is passed it returns 2 rows but i want ony one row as there is only one employee.
Please help;
Edited by: user10239708 on 10 Sep, 2008 12:24 AM
Edited by: user10239708 on 10 Sep, 2008 12:28 AMTry this
Select
from
tableA a
where
(exists (select 1 from tableB b where a.empid = b.empid and deptid = :IN_DEPTID )
or
:IN_DEPTID is null) you database design is not good you should keep the emp, department mapping in different table.
Regards
Singh -
Remove a row from multiple tables
Hello,
I have a form that has what appears to be one table. Since I needed 30 columns (29 of them are single character fields) I had to use 2 table objects. Then I needed the ability to add and remove rows. Adding a row at the end is easy enough. Deleting a specific row is the problem. At the moment, I added a third table which has a header row and a item body row. the body row is a button with the intention of removing that entire row from the large table. This means it needs to remove the row from all 3 tables.
My structure is:
form1
(Some other flowed subform that doesn't matter for us)
SubformPersonnel (a flowed subform)
SubformHeader (a positioned subform)
TextOverallHeader (text to label the oeverall 3 tables)
ButtonAddRow (adds a row to the end of all 3 tables)
SubformPersonnelTable (a positioned subform)
ContractorTableRemove (a table with 1 column for the Remove button)
HeaderRow (A hidden row to align the table with the other 2)
Item (A row with the Remove button)CellRemoveButton (the cell with the remove button and associated JavaScript)
ContractorTableLeft (a table with the left 15 printed columns)
HeaderRow
Contractor (A row of data to be removed when CellButton above is clicked)
ContractorTableRight (a table with the right 15 printed columns)
HeaderRow
Contractor (A row of data to be removed when CellButton above is clicked)
(Some other flowed subforms that I am not worried about at the moment)
The 3 tables are aligned so the headers all line up, with no spaces between them. The body rows then line up and this looks like one large table. From left to right, they are:
ContractorTableRemove, ContractorTableLeft, ContractorTableRight
So Item and Contractor rows are added when ButtonAddRow is clicked in the overall header. The intial count is set to 8 for each table, so I get 8 rows at startup. The minimum count is set to 1 for each. I know that each row of each table has the same index number because I filled those into a cell in each table durig the cell's initialize. This line, in the CellRemoveButton's click event deletes that cell's row in that table:
this.parent.parent._Item.removeInstance(this.parent.index);
I have tried all sorts of ways to delete the same row (using same index #) in the other 2 tables: ContractorTableLeft and ContractorTableRight, but don't seem to be getting the correct syntax correct. I have tried hard coding the references, using .parent as shown below, and also tried using an index of 1 just to try deleting a row with no results.
this.parent.parent.parent.ContractorTableLeft._Contractor.removeInstance(this.parent.inde x);
Can someone get me the correct syntax here?
I have seen examples of putting a hidden delete button on each table and clicking that, but I am concerned that it will get in the way of the tables on either side of the table it is in. I reeally want to just reference the row and remove it so I can avoid any problems these additional delete problems may cause.
I have copied the form to https://acrobat.com/#d=7M8R50rEHf4AaVXppwyKLwThank you, Niall. Much appreciated!
The Delete button was more to make sure one could delete these outside a button in the actual row and I see I had the index wrong such that I was deleting the second row and not the first. I had toyed with using this as a hidden button if I could pass the index to the event's function.
I had not thought of adding the reference to each row as a variable. It seems to work very well.
For future reference to others, here is the code from the cellRemoveButton click event:
// Declare some variables
var i = this.parent.index;
var oContractorLeft = ContractorTableLeft.Contractor;
var oContractorRight = ContractorTableRight.Contractor;
// Remove this row by accessing its index within the set of 'Item' row instances of the parent table
_Item.removeInstance(i);
// Since this table is actually 3 tables, we need to remove the other two table's instances as well.
// Their index should be the same, so we just need to get their names correct.
oContractorLeft.instanceManager.removeInstance(i);
oContractorRight.instanceManager.removeInstance(i);
// removing the row doesn't trigger calculations in tables in the form's current target (fixed in later versions of Acrobat)
// force calculations to fire so the ItemIndex field's value is updated according to the remaining row's indexes
// see http://forms.stefcameron.com/2006/05/20/add-recalculate/
xfa.form.recalculate(1);
Again, thank you!
Karl -
How do I remove a row from the database?
Guys and Gals,
I'm using Studio Edition Version 11.1.1.3.0.
The code below will delete a row from my table, but how do I actually delete the row from the database as well?
DCBindingContainer dcbc = (DCBindingContainer)getBindings();
DCIteratorBinding dcib = dcbc.findIteratorBinding("TipsSelectorIterator");
dcib.removeCurrentRow();
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("Commit");
Object result = operationBinding.execute();
AdfFacesContext adffacesctx = AdfFacesContext.getCurrentInstance();
adffacesctx.addPartialTarget(this.getQueryTable()); In this post, I believe Frank sums up what I should do: Remove row from af:table
>
The problem in your case is that this removes the row from the iterator but not your business service. EJB exposes explicit methods to remove an entity. A method lime removeEmployees(employee) >expsed on the EJB model must be called.
You can drag and drop the "removeEmployees" method then as a button to your page. Rename the text label to "Remove" or "Delete". In the opened dialog box, point the method argument to the >following EL #{bindings.iteratorName.currentRow.dataProvider}. Next time you press the button, the row is deleted from the iterator and the business service
Huh? So to delete the row, I need to expose a method. But where? Do I do this in the AppModuleImpl so I can expose it to the Client Interface? But then how do I access entities? And what data type is the #{bindings.iteratorName.currentRow.dataProvider}?
If anyone could point me in a general direction, it'd be great.Frank and Shay,
Thank you both for your posts. I'm amazed there's such a great place to get help. Between the forums, ADF code corner, Not Yet Documented ADF Samples, various blogs and tutorials, it's obvious you guys really care about what you do.
On my example, that approach doesn't seem to work. I tried following it like so in one of the video tutorials by Shay: http://blogs.oracle.com/shay/2010/04/doing_two_declarative_operatio.html. Following Shay's approach, in my particular case, deletes only from the table. Perhaps it is due to my iterator / collection setup?
TipsSelector (1 to 1) -> TipsView (1 to *)-> DependentBom -(1 to * Recursive)> RecursiveBom
TipsSelector references the same View Object as TipsView, but it is set as a 1 to 1 relationship so that I can show TipsView on the page one record at a time. This is the same setup as Tuhra2's hierarchy veiwer example. TipsView / DependentBom is a classic parent / child setup. RecursiveBom is DependentBom referencing itself. Think of it as departments within departments within departments etc...
I have dragged TipsSelector's Named Criteria (All Queriable Attributes) onto my page and created an ADF Query with Table. A remove button on the table's toolbar calls the two actions, Delete (from TipsSelector's iterator) and then Commit. I have modified the code slightly from my previous post but the end result seems to be the same.
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("Delete");
operationBinding.execute();
bindings = getBindings();
operationBinding = bindings.getOperationBinding("Commit");
operationBinding.execute();
AdfFacesContext adffacesctx = AdfFacesContext.getCurrentInstance();
adffacesctx.addPartialTarget(this.getQueryTable());Page Def file
<action id="Commit" InstanceName="AppModuleDataControl"
DataControl="AppModuleDataControl" RequiresUpdateModel="true"
Action="commitTransaction"/>
<action IterBinding="TipsSelectorIterator" id="Delete"
InstanceName="AppModuleDataControl.TipsSelector"
DataControl="AppModuleDataControl" RequiresUpdateModel="false"
Action="removeCurrentRow"/>On ppr of the query table, the row is gone. However, when I press the Search button on the query again, the record reappears.
This is beyond me. Am I somehow deleting from the query results but not the database? -
Removing Not Assigned from the query
Hi,
I have one query, in which the data is displayed as shown below
Country City Amount
India Mumbai 10000
Delhi 10000
US Los Angeles 20000
New York 30000
Not Assigned Sydney 80000
If I sort/descending on the Amount, I will get Sydney as a top. But the moment, I remove the city from the query, my output is displaying as mentioned below
Country Amount
Not Assigned 80000
US 50000
India 20000
I need the help in displaying the output as mentioned below. (Basically, instead of Not Assigned, Syndey
should be displayed)
Country Amount
Syndey 80000
US 50000
India 20000
Please help if any code / formula needs to be written, to acheive the above result.
Thanks & Regards
Ramesh GanjiThis can be acheived if you can save this query as a workbook and writing Excel Formulas.
You have to Insert a column and wirte a Formula like
( I am assuming column B is country and A is City and you have inserted column is A and the formula you are writing in the 10th row)
= IF(B10= "Not Assigned",C10,B10)
copy this formula to all the rows for the column A.
Now based on this column you can sort your report.(Excel sort).
Save the workbook.
Regs
Gopi
Assign points if it helps .... -
Identifying and reporting Duplicate rows from table
I want to fetch all the duplicate row from the table and need to report all of it.
I am trying to run the below query but and not getting the expected output. Please help me.
Query
SELECT * FROM ADDT_RPT_REQ A WHERE
TRIM(A.EMAIL_ADDR) IN
(SELECT TRIM(EMAIL_ADDR) FROM ADDT_RPT_REQ B
WHERE TRIM(B.EMAIL_ADDR) = TRIM(A.EMAIL_ADDR)
AND A.ph_num IN
(SELECT PH_NUM FROM ADDT_RPT_REQ B
WHERE TRIM(A.PH_NUM ) = TRIM(B.PH_NUM)
There are in all 7 columns in the table where id is Unique Id.
The expected output is something like.
FST_NAME LAST_NAME EMAIL_ADDR WORK_PH_NUM ROW_ID LAST_UPD BU_ID
VALERIE HALL [email protected] 7819370177 2-21N-4312 31-AUG-04 0-R9NH
VALERIE HALL [email protected] 7819373737 2-21N-4327 29-JAN-04 0-R9NH
VALERIE HALL [email protected] 6034272034 2-21N-4309 04-APR-03 0-R9NH
VALERIE HALL [email protected] 7819373737 2-21N-4317 04-APR-03 0-R9NH
VALERIE HALL [email protected] 8563748820 2-21N-4329 31-AUG-04 0-R9NH
VALERIE HALL [email protected] 7819373737 2-21N-4319 04-APR-03 0-R9NH
VALERIE HALL [email protected] 7819373737 2-21N-4326 04-APR-03 0-R9NH
VALERIE HALL [email protected] 7819373737 2-21N-4324 04-APR-03 0-R9NH
VALERIE HALL [email protected] 8604237395 2-21N-4330 31-AUG-04 0-R9NH
VALERIE HALL [email protected] 7819373731 2-21N-4314 31-AUG-04 0-R9NH
VALERIE HALLORAN [email protected] 6194771101 2-21N-4331 31-OCT-05 0-R9NH
VALERIE HALL [email protected] 7819373737 2-21N-4316 04-APR-03 0-R9NH
VALERIE HALL [email protected] 7819373737 2-21N-4321 04-APR-03 0-R9NH
VALERIE HALL [email protected] 7819373737 7-1W4N-293 15-MAY-04 0-R9NH
VALERIE HALL [email protected] 2032341604 2-21N-4307 31-AUG-04 0-R9NH
VALERIE HALL [email protected] 7819373737 2-21N-4325 04-APR-03 0-R9NH
VALERIE HALL [email protected] 7819373737 2-21N-4315 29-JAN-03 0-R9NH
VALERIE HALL [email protected] 7819373737 7-1W4N-291 15-MAY-04 0-R9NH
VALERIE HALLORAN [email protected] 6194771101 2-21N-4332 31-OCT-05 0-R9NH
VALERIE HALL [email protected] 6038885349 2-21N-4310 31-AUG-04 0-R9NH
VALERIE HALL [email protected] 7819373737324 2-21N-4328 31-AUG-04 0-R9NH
VALERIE HALL [email protected] 7819370177324 2-21N-4313 31-AUG-04 0-R9NHHi again!
Try that:
SELECT rowid, fst_name, last_name, email_addr, work_ph_num, row_id, last_upd, bu_id
FROM ADDT_RPT_REQ A
WHERE rowid > (SELECT MIN(rowid)
FROM ADDT_RPT_REQ B
WHERE B.fst_name = A.fst_name
AND B.last_name = A.last_name
AND B.email_addr = A.email_addr
AND B.work_ph_num = A.work_ph_num
AND B.row_id = A.row_id
AND B.last_upd = A.last_upd
AND B.bu_id = A.bu_id);This query should show you all duplicate rows. Use the rowid and DELETE to get rid of these rows.
DELETE FROM addt_rpt_req A
WHERE rowid IN (SELECT rowid
FROM (SELECT rowid, row_number() OVER (PARTITION BY fst_name, last_name, email_addr, work_ph_num, row_id, last_upd, bu_id
ORDER BY row_id) dup
FROM addt_rpt_req)
WHERE dup > 1);Yours sincerely
Florian W.
Edited by: Florian W. on 17.06.2009 14:17 -
Removing duplicate values from selectOneChoice bound to List Iterator
I'm trying to remove duplicate values from a selectOneChoice that i have. The component binds back to a List Iterator on the pageDefinition.
I have a table on a JSF page with 5 columns; the table is bound to a method iterator on the pageDef. Then above the table, there are 5 separate selectOneChoice components each one of which is bound to the result set of the table's iterator. So this means that each selectOneChoice only contains vales corresponding to the columns in the table which it represents.
The selectOneChoice components are part of a search facility and allow the user to select values from them and restrict the results that are returned. The concept is fine and i works. However if i have repeating values in the selectOneChoice (which is inevitable given its bound to the table column result set), then i need to remove them. I can remove null values or empty strings using expression language in the rendered attribute as shown:
<af:forEach var="item"
items="#{bindings.XXXX.items}">
<af:selectItem label="#{item.label}" value="#{item.label}"
rendered="#{item.label != ''}"/>
</af:forEach>
But i dont know how i can remove duplicate values easily. I know i can programatically do it in a backing bean etc.... but i want to know if there is perhaps some EL that might do it or another setting that ADF gives which can overcome this.
Any help would be appreciated.
Kind RegardsHi,
It'll be little difficult removing duplicates and keeping the context as it is with exixting standard functions. Removing duplicates irrespective of context changes, we can do with available functions. Please try with this UDF code which may help you...
source>sort>UDF-->Target
execution type of UDF is Allvalues of a context.
public void UDF(String[] var1, ResultList result, Container container) throws StreamTransformationException{
ArrayList aList = new ArrayList();
aList.add(var1(0));
result.addValue(var1(0));
for(int i=1; i<var1.length; i++){
if(aList.contains(var1(i)))
continue;
else{
aList.add(var1(i));
result.addValue(var1(i));
Regards,
Priyanka -
How to remove a row from a rowset
HI,
I am trying to do a very simple thing, but I got stuck.
The problem:
I want to remove a row from a rowset, without removing the row itself. Especially I do not want to remove any entities.
I need this functionality in several situations, for example when I want to move a row from one rowset to another.
Another situation is when I have a viewlink not based on an association. When a row is modified so it does not fit to the viewlink's where clause anymore, I need a way to remove it manually (without removig any associated entities),
I hope someon can help me on this,
thanks,
FrankSascha:
The only workaround I can think of is a true hack, and you'd be entering into a unchartered territory. But, it may be worth a try.
First, you need to create a subclass of oracle.jbo.server.ViewObjectImpl in the oracle.jbo.server package. This is because you need to override one of the package private methods. Suppose you define oracle.jbo.server.TempBaseViewObjectImpl which extends ViewObjectImpl.
Override the following method:
int[] getDeleteParticipants()
This method returns an array of EO bases for which ViewRow's delete should cause deletion of EntityRow's.
So, before you remove a ViewRow, you should set some flag in your TempBaseViewObjectImpl, so that getDeleteParticipants() would return "new int[0];" This will cause no EntityRow's to be deleted. Only the ViewRow will be removed from the collection.
Note that you should reset this flag after the operation, so that you can delete the EntityRow's (when necessary).
Your real VO should then subclass TempBaseViewObjectImpl.
Once we fix this problem and provide a real API, you should remove TempBaseViewObjectImpl and extend your real VO from ViewObjectImpl instead of TempBaseViewObjectImpl.
Thanks.
Sung -
Remove duplicate holidays from calendar mac
How do I remove duplicate holidays from calendar mac. I have iCloud and I have read that may be part of the problem, but I need help to remove duplicate holidays from calendar mac.
ThanksIf you have iCloud and another account like Gmail, you could be seeing holdays for each account. You need to deselect one of the holiday calendars.
Do you see Holidays in the sidebar where Calendars are listed? If yes, uncheck.
iCloud: About subscribed calendars - Apple Support
Maybe you are looking for
-
Enhacer ant task license key problem
Hi, I'am developing web applicaiton with workshop studio 3.0 and I use It's ejb3(kodo 4 EA4) mapping generator.I try to use ant task for enhancement,here is my build.xml file's kodoc task <target name="enhance"> <echo> ================
-
CP6 HTML5 output file, show/hide don't work
Hi all, I've create a menu screen where I have grouped some graphics to a button and disabled 'visible in output'. I then created a conditional script to show or hide the group depending on interaction, assigning the script to the slide on enter. How
-
Dear Experts, We have ROH, HALB & ZMAT as materials. The question is with respect std. cost estimate. The cost estimate are run for HALB & ZMAT items created on day to day basis. However cost estimate is executed for all the HALB & ZMAT on altern
-
Adobe Professional - link action - File Exit doesn't work as it should
In Adobe Professional, create a new link using the following steps: - Create Link - Custom Link - Click Next - Go to the Actions tab - Select the 2 following Actions: - File>Close - File>Exit - Click Ok on the 2 dialog boxes. -save the pdf
-
HT5312 i forgot my security question please help me
i forgot my security question answers please guide me regarding this <Email Edited by Host>