New Posts New Posts RSS Feed: Comparing Entitylists
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Comparing Entitylists

 Post Reply Post Reply
Author
Darren View Drop Down
Newbie
Newbie
Avatar

Joined: 06-Jul-2007
Location: United Kingdom
Posts: 23
Post Options Post Options   Quote Darren Quote  Post ReplyReply Direct Link To This Post Topic: Comparing Entitylists
    Posted: 30-Oct-2007 at 8:37am
Got it to work david..... Thanks
 
I dont know what i was thinking.....guess i just got a carried away with trying to over complicate things.....who knows.
 
We all have our bad days.....lol
 
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 29-Oct-2007 at 10:06am
You wouldn't necessarily have to use the ORM Mapper on the data coming from the spreadsheet.  Just read each row of the spreadsheet.  Extract the three columns from the row, and then query the EntityList for a match.
Back to Top
Darren View Drop Down
Newbie
Newbie
Avatar

Joined: 06-Jul-2007
Location: United Kingdom
Posts: 23
Post Options Post Options   Quote Darren Quote  Post ReplyReply Direct Link To This Post Posted: 29-Oct-2007 at 9:46am

David

The excel sheet is loaded at runtime , so i would not be able to use the ORM mapper.
 
I have that 3column datatable to compare against the entitylist
 
Do you have code sample for doing the compare this way.
 
I can do this with 2 .net datatables no problem using the merge method.
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 26-Oct-2007 at 10:18am
Take the datatable created from the spreadsheet and add it to your solution using the ORM.  The added table may or may not have the same datasource as the table that is the source for your EntityList
 
You could now, of course, just compare each row in the table generated from the spreadsheet with each object in your EntityList, but here is something that is a little fancier. 
 
Create a new PersistenceManager and import your EntityList into the PM's cache.
 
For each row in the spreadsheet table:
 
(1)  If there could be duplicate rows between the two tables, search the new PM's cache for the row in the spreadsheet table with the 3 matching columns.  Be sure to use a QueryStrategy of CacheOnly.  If you find a match, it's a duplicate.  Ignore that row.
 
(2)  If the row is not a duplicate, create a new row (i.e., object), copy the values from the three columns, and add the new object to your EntityList.
 
 


Edited by davidklitzke - 26-Oct-2007 at 10:28am
Back to Top
Darren View Drop Down
Newbie
Newbie
Avatar

Joined: 06-Jul-2007
Location: United Kingdom
Posts: 23
Post Options Post Options   Quote Darren Quote  Post ReplyReply Direct Link To This Post Posted: 26-Oct-2007 at 7:44am

Some guidance needed please.

I have an EntityList called mUser that contains 3 columns.
I import data from an excel spreadsheet and populate a .net datatable
The datatable has the same 3 columns as the EntityList.
 
I would like to compare these objects and then return an updated entitylist back to the PersistenceManager.
 
Any ideas would be great or a alternative method.
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down