Remove duplicate entry in list component
I have a list component which loads xml into it. I have
multiple entries in the list that are the same and i want to remove
the duplicates. if anyone has an idea or hint it would be
appreciated.
Thanks
"Rain1522" <[email protected]> wrote in
message
news:ebamrt$s5h$[email protected]..
>I have a list component which loads xml into it. I have
multiple entries in
>the
> list that are the same and i want to remove the
duplicates. if anyone has
> an
> idea or hint it would be appreciated.
>
> Thanks
>
> function loadGulf(){
> import mx.xpath.XPathAPI;
> var cityXml:XML = new XML();
> cityXml.ignoreWhite = true;
> cityXml.onLoad = function(success:Boolean) {
> trace("onload...");
> if (success) {
> trace("success...");
> // Retrieve all Cities notes within /document/City.
> var thePath_str:String = "/document/City"; // path of
nodes
> var plan_array:Array =
XPathAPI.selectNodeList(this.firstChild,
> thePath_str);
> for (var i:Number = 0; i < plan_array.length; i++) {
> var planArray = plan_array
.firstChild.nodeValue;
>
> function checkMatch(compare:String) {
> for(j=0;j<myList.length;j++){
> if (myList.getItemAt(j).label==compare){
> return true;
> }
> }
> }
>
if(checkMatch(plan_array.firstChild.nodeValue)!=true){
> myList.addItem(plan_array
.firstChild.nodeValue);
> }
>
> }
> } else {
> trace("error loading XML");
> }
> };
> cityXml.load("new.xml");
> }
> loadGulf();
>
I have a book with a function for quick searching arrays, but
it is at work.
If not answered by tomorrow morning then I will try to
remember to post a
solution.
Similar Messages
-
Help required on mapping to remove duplicate entries
Hi all experts,
I need some help in mapping. I am new to this tool. How would I remove duplicate entries in source payload? My structure is as follows
Message Structure
<List> 1-1
<ParentNode> 0-unbounded
<Child1> 0-1
<Child2> 0-1
Source:
<List>
<ParentNode>
<Child1>PK1</Child1>
<Child2>SomeValue1</Child2>
</ParentNode>
<ParentNode>
<Child1>PK1</Child1>
<Child2>SomeValue1</Child2>
</ParentNode>
<ParentNode>
<Child1>PK2</Child1>
<Child2>SomeValue2</Child2>
</ParentNode>
</List>
Target I would like:
<List>
<ParentNode>
<Child1>PK1</Child1>
<Child2>SomeValue1</Child2>
</ParentNode>
<ParentNode>
<Child1>PK2</Child1>
<Child2>SomeValue2</Child2>
</ParentNode>
</List>
Any help?
Thanks so much allHi,
Please note that in my reply I asked you to map ParentNode with <Child1> Please see the below.
<Child1>-->RemoveContext Node function>Split by Value(set the property as on value change)->CollapseContext---<ParentNode>
Secondly: introduce split by value(for each value ) after collapse context for child1 and child2. as shown below.
<Child1>-->RemoveContext Node function>Split by Value(set the property as on value change)->CollapseContext>Split by value(for each value)----</Child1>
<Child2>-->RemoveContext Node function>Split by Value(set the property as on value change)->CollapseContext>Split by value(for each value)----</Child2>
it will surely work, -
Remove duplicate entries from dropdownlist in web dynpro abap
How to remove duplicate entries from dropdownlist in web dynpro abap? Can someone please help me
I have maintained the data in the z table wherein the records of particular fields are repeated but when i show that record in the Web Dynpro application dropdown list, the user should only be able to view the unique data for selection of that particular field.Hi,
try this code in init method.
use the
Delete adjacent duplicates.
<set the table>
select <f1> from <table> into TABLE <Itab> whre <condition>.
DELETE ADJACENT DUPLICATES FROM <Itab> COMPARING <f1>.
lo_nd_vbap->bind_table( new_items = <itab> set_initial_elements = abap_true ). -
Help needed in removing duplicate items of list box in java
How to remove duplicate items of list box while dynamically inserting (on-click event)
It is not identifying duplicate data
Variable name is HP_G1
HP_dmg1 = (DefaultListModel) HP_G1.getModel();
int a = HP_G1.getModel().getSize();
System.out.println("HP list no--------> "+a);
if(a!=0)
for (int j=0; j<a; j++)
String item1 = String.valueOf(HP_List.getModel().getElementAt(j));
System.out.println("HP list added--------> "+item1);
if(HP_dmg1.equals(item1)){
HP_dmg1.remove(j);
else
HP_dmg1.addElement(GPL);
}Your code is unreadable, so I'll ignore it. In the future please press the message editor's CODE button to format code.
As to your problem, to the point you normally use a Set instead of List when you don't want duplicates in a collection. -
TS4062 how do i remove duplicate entries from my phone directory?
question; how do i remove duplicate entries from my phone directory?
go to your contacts icon and choose the one you want to delate
Choose edit, top right and go (scroll) to the bottom of the page and press delete contact -
How do I remove duplicate entries in my Contact List?
I imported my contact list from MS Outlook, but for some reason there are many duplicate entries in Thunderbird.
This add on claims to do what you want. I have never used it so I cannot comment on if it works.
https://addons.mozilla.org/en-US/thunderbird/addon/duplicate-contact-manager/?src=ss -
Trick to remove duplicate entries from tables ?
hi.
i have 53tables which are having duplicate entries and names of all 53 tables r listed in top_t table ?
can any1 provide me solution to show and if possible ask for remove of those duplicates entries from each table if required ?
daily i am removing duplicates manually ....its too tedious now !
can any1 help me out ?Well, I suppose if the duplication is such that
SELECT DISTINCT * FROM tablename;gives you the required result, then you could have a procedure that made a copy of the table, deleted/truncated the original, then inserted the distinct values back into it.
In 10g you could even use flashback to avoid the temp copy - but it also means you can't use TRUNCATE so whether it's any more efficient I'm not sure. But just for fun and since it's urgent:
CREATE OR REPLACE PROCEDURE dedupe_table
( p_table_name user_tables.table_name%TYPE )
IS
k_start_timestamp TIMESTAMP := SYSTIMESTAMP;
BEGIN
SAVEPOINT start_of_dedupe;
BEGIN
EXECUTE IMMEDIATE 'DELETE ' || p_table_name;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK TO start_of_dedupe;
RAISE_APPLICATION_ERROR
( -20000
, 'Error deleting ' || UPPER(p_table_name) ||
CHR(10) || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE
, TRUE );
END;
BEGIN
EXECUTE IMMEDIATE
'INSERT INTO ' || p_table_name ||
' SELECT DISTINCT * FROM ' || p_table_name || ' AS OF TIMESTAMP :b1'
USING k_start_timestamp;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK TO start_of_dedupe;
RAISE_APPLICATION_ERROR
( -20000
, 'Error repopulating ' || UPPER(p_table_name) ||
CHR(10) || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE
, TRUE );
END;
END dedupe_table;
SQL> select * from wr_test;
COL1 C C
1 A B
1 A B
2 C D
2 C D
4 rows selected.
SQL> BEGIN
2 dedupe_table('WR_TEST');
3 END;
4 /
PL/SQL procedure successfully completed.
SQL> select * from wr_test;
COL1 C C
1 A B
2 C D
2 rows selected.I make no claims for robustness, efficiency or human safety.
Edited by: William Robertson on Sep 24, 2009 7:12 PM -
How to remove duplicate entries from Settings General iTunes Wi-Fi Sync?
On my iPhone under Settings > General > iTunes Wi-Fi Sync there is a duplicate entry for my Mac. One is active, the other one shows options greyed out, as if it can't see the Mac on the network (although it's the same name). Is there a way to manually remove that entry from the iPhone?
I am running iOS 7.0.4, and OS X 10.9.1, iTunes 11.1.3 on the Mac.iPhone 3G doesn't support Wi-Fi sync or IOS 5.1.1. You have to connect to iTunes using the dock connector to sync.
Unless you have a iPhone 3GS or jailbroken. -
How to remove duplicate entries in OID due to an AD-OID bootstrap
Don't worry about the "why" but there were changes made to the mapping file for an AD-OID synch and dipassistant commands mp and bootstrap run and now there are some duplicate entries for users in OID. The only difference between the duplicates for each of those user (besides the creation/modify timestamps) is their ORCLGUID. Their orclobjectsid, orclobjectguid, dn, uid, etc. are the same. Also, our OID is used for SSO to an oracle portal. So ... is there any way to programmtically get rid of the duplicates or do I have to manually go through and delete. And if manually, which one of the two should be removed? The one created first or last?
You'll have to excuse myself and my co-workers 'cause we're still newbies when it comes to OID. :-)Found an easier way to delete my unwanted users ... Softerra LDAP Administrator 3.5. :-)
After I did the deletes, we implemented a new mapping file (see my post at Changing Domain Rules in mapping file for Active Directory-OID synch ) and ran bootstrap. Now I just have to update the GUID and DN in portal.wwsec_person$ with the new orclguid and dn from OID for each affected user. -
Remove duplicate entry from table
Hello all,
In my one table
File Stage log (File_Stage_Log_ID int identity(1,1),File ID int ,Quarter_Date nvarchar(50),StageID int )
have done duplicate entry by mistake on similar quarter_date
something like ..
FILE_ID
Quarter
FILE_STAGE_LOG_ID
STAGE_ID
22401
Dec-13
233091
450
22401
Dec-13
244116
420
22401
Mar-14
233095
450
22401
Mar-14
237478
405
22401
Jun-14
237479
405
22401
Jun-14
233099
450
22401
Sep-14
233102
450
22401
Sep-14
237480
405
22401
Dec-14
237481
405
22401
Dec-14
227275
420
there are too many files which have the same duplicacy ..
now , above you can see that dec -13 quarter coming twice for a single file
tell me the way to delete one entry from the table for a files
so that i have output at the end like ...
FILE_ID
Quarter
FILE_STAGE_LOG_ID
STAGE_ID
22401
Dec-13
233091
450
22401
Mar-14
233095
450
22401
Jun-14
237479
405
22401
Sep-14
233102
450
22401
Dec-14
237481
405
Please help me with easiest possible way ..
Dilip Patil..How do you determine which one out of duplicate to be kept? As per output it doesnt follow any pattern
so it may be this
--DELETE t
SELECT *
FROM
SELECT ROW_NUMBER() OVER (PARTITION BY FILE_ID,Quarter_Date ORDER BY FILE_ID) AS Rn,*
FROM FileStageLog
)t
WHERE Rn >1
Run the select above to see records to be removed and once happy uncomment the delete, comment the select * and run the query to do the delete
If it doesnt give expected records, explain on what basis you want to identify records to be deleted
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
Remove duplicates items in List
I created a WebAPI and its calling an SQL Server to get my data. I created a List<> to populate and get those items back to UI. However, in my output there are duplicates due to the data. Is there a way to remove the duplicate strings before passing
it back to my UI?
I'm reading through the data coming back from SQL here
while (reader.Read())
Jobs jobs= new Jobs();
jobs.FunctionDesc = reader.GetString(0);
jobs.Function = reader.GetString(1);
jobss.Add(jobs);
}return jobs
is there a way I can remove the duplicate FunctionDesc prior to returning it back to the UI?You could keep populating the List<Jobs> exactly like you are doing now, create a class that implements the IEqualityComparer<Jobs> interface and simply pass an instance of this one to the Distinct method that you call on the list once you have
populated it:
public class JobsComparer : IEqualityComparer<Jobs>
public bool Equals(Jobs x, Jobs y)
return x.FunctionDesc.Equals(y.FunctionDesc);
public int GetHashCode(Jobs obj)
return obj.FunctionDesc.GetHashCode();
while (reader.Read())
Jobs jobs= new Jobs();
jobs.FunctionDesc = reader.GetString(0);
jobs.Function = reader.GetString(1);
jobss.Add(jobs);
jobss = jobss.Distinct(new JobsComparer()).ToList();
return jobss;
This will effectively remove all duplicates with minimal changes to your current code.
Hope that helps.
Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. -
How to Remove duplicate entries in address book
After syncing with iCloud (three computers and a phone) suddenly I am seeing multiple entries for the same contact in the address book and multiple entries in the calendars for the same event. Can anyone suggest how to stop this and how to delete the multiple entries without having to manually delete each item? The new Address book does noit seem to have a list view that shows the entire address book 9only shows addresses with two or three alphabets...
Is there a setting to prevent this from happening? I had similar experiences with the old Mobile.me and was hoping the problem had been fixed.
The value of iCloud is lessened when these issues crop up and there seems to be no defined method to fix the problem. I see numerous entries on the Support Community boards with the same problem.
Any suggestions? Thank you.Hi,
Take a look at Address Book Account Basics (with iCloud). and Duplicate address Book entries.
I too had the same issue and this helped solve it.
Hope this helps. -
How to remove duplicate entries in about:config
I've got duplicate listings for browser.cache.memory.capacity in about:config. I'd like to remove one and leave one, but I can't seem to do this, nor have I found any FAQ etc. with directions on how to do this. Please advise. Thanks very much
Right-click (or control-click) on a preference and choose '''Reset''', then re-start Firefox. This preference does not exist by default and this method will delete the preference. This preference should be an integer, if you have one set as a string then reset that one to delete it.
-
Table Search Help to Remove Duplicate Entry
Hi All Tha ABAP GURUS,
I have created 2 tables say A with fields main description and sub decription and another table B in which there are these 2 fields with other fields. I want to display search help for Table B for fields main description and sub decription separately and I have done the same by creating Elementary Search Help (ZDS and ZDM resp.) . For sub description it is working fine and for main description it is displaying value but duplicate. How to remove these duplicate values.
For Eg Values are
Main Desc Sub Desc
1 A
1 B
1 C
2 D
2 E
In my case it is showing
1
1
1
2
2
but I want
1
2
I want to achieve this without creating any ZProg. Can I use search help exit.Kindly guide me in this matter how to use it.
Thanks & Regards,
Bharti JainYes you can delete duplicates in a search help exit, but not without "without creating any ZProg" as you will create a Function Module (and Group)
Duplicate the sample FM F4IF_SHLP_EXIT_EXAMPLE in a customer function group, and delete duplicate records of RECORD_TAB in the step 'DISP' (executed before display).
You could also perform the select yourself adding a DISTINCT option to the statement in the 'SELECT' step but this will take more time to develop, as you must read the other parameters to use selections provided by user or program.
Regards
Raymond, -
Using powershell to check and removing duplicate entries
Hi Guys,
I have been trying to get my head around powershell to check a csv file. It needs to read in each line in the csv and compare it to the last one and only pull out the entry with the newest time stamp. The data is something like this (btw it has no headers
pulled into the csv file).
UID,Type,Sub,Blank,deviceID,Brand,V#,OS,DType,Blank,Date/time
TT1234567,PRINT,7DAY_SUB,,7DD758034,iPad3,6,IOS,Tablet,,2014-09-22T10:59:40.345Z
TT1234567,PRINT,7DAY_SUB,,7DD758034,iPad3,6,IOS,Tablet,,2014-09-22T11:00:40.500Z
TT1234567,PRINT,7DAY_SUB,,f04f7c213b0f,kftt,2,KINDLE,Tablet,,2014-09-23T11:25:16.303Z
TT1234567,PRINT,7DAY_SUB,,f04f7c213b0f,kftt,2,KINDLE,Tablet,,2014-09-23T11:25:18.303Z
TT1234567,PRINT,7DAY_SUB,,08606eb42491,nexus7,4.4,ANDROID,Tablet,,2014-09-24T14:48:23.668Z
TT1234567,PRINT,7DAY_SUB,,08606eb42491,nexus7,4,4,ANDROID,Tablet,,2014-09-24T14:48:24.700Z
[email protected],DIGITAL,DIG_SUB,,08606eb42491,nexus7,4.4,ANDROID,Tablet,,2014-09-24T15:09:08.359Z
[email protected],DIGITAL,DIG_SUB,,08606eb42491,nexus7,4.4,ANDROID,Tablet,,2014-09-24T15:09:09.468Z
TT1234567,PRINT,7DAY_SUB,,7DD758034,iPad3,6,IOS,Tablet,,2014-09-25T11:59:40.345Z
TT1234567,PRINT,7DAY_SUB,,7DD758034,iPad3,6,IOS,Tablet,,2014-09-25T11:59:45.345Z
Output to file should be like the following.
TT1234567,PRINT,7DAY_SUB,,7DD758034,iPad3,6,IOS,Tablet,,2014-09-25T11:59:45.345Z
TT1234567,PRINT,7DAY_SUB,,f04f7c213b0f,kftt,2,KINDLE,Tablet,,2014-09-23T11:25:18.303Z
TT1234567,PRINT,7DAY_SUB,,08606eb42491,nexus7,4,4,ANDROID,Tablet,,2014-09-24T14:48:24.700Z
[email protected],DIGITAL,DIG_SUB,,08606eb42491,nexus7,4.4,ANDROID,Tablet,,2014-09-24T15:09:09.468Z
Same UID can have multiple devices we want to know all the devices and the latest time stamp. As you can see that
TT1234567 used the ipad on the 2014-09-22T11:00:40.500Z
but then used it again on the 2014-09-25T11:59:45.345Z we only want the newest time stamp for that device.
I hope you guys can help me out.Hi Nguyen,
First of all, add a header for your csv (simplifies things a bit):
ID,Type,Sub,Blank1,deviceID,Brand,VNum,OS,DType,Blank2,DateTime
Then this single line will get you what you want:
import-csv test.csv | group deviceID | %{$_.Group | Sort DateTime | Select -Last 1}
Please note:
Make sure your Csv conforms to Csv Standards (especially that the Delimiter is
only used as delimiter, which in your sample data was not the case). If you cannot ensure this, you need to create a validation routine and fix it before you use this line. Too many delimiters will drop the DateTime from the list, leaving a blank datetime,
causing the filtering to fail.
Cheers,
Fred
There's no place like 127.0.0.1
Maybe you are looking for
-
Problems installing Oracle 9i Database on Windows XP Pro
Please Help!!!!!!!!! When trying to install the Personal Edition Database, the installer never asks for the additional disk to be inserted and, after running for a while the Universal Installer disappears with no error window, therefore not completin
-
Can't select albums with photoshop elements 10 with iTunes 10.6
I first upgraded Itunesvto 10.6 and the downloaded the trial version of adobe photoshop elements 10, never had any previous photoshop versions. When I go into iTunes and go under the sync photos tab and select the photoshop elements for "sync from"
-
The server gave an error during download: 500 Internal Server Error
Does this mean the servers are overloaded? I've installed Lion on two of my MACs. Can't get past the "The server gave an error during download: 500 Internal Server Error" message on my third system. Anyone?
-
ok. Just got this computer couple days ago. It is an HP Pavilion Smart touch 23" with windows 8.1 (64 bit) I downloaded origins and a free trial game from it (battlefield 3). I can't play the game because it requires a plug in to be installed. But th
-
How to write CMP on Database VIEWs
Hi In my application i have database views. i want to write a CMP bean for each VIEW. is it possible To write a CMP Bean on VIEWs. if possible Pl let me know and send some code too. thank u