New Posts New Posts RSS Feed: Duplicate Records
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Duplicate Records

 Post Reply Post Reply
Author
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Topic: Duplicate Records
    Posted: 28-Jun-2012 at 12:23pm
Hi Von,
 
You could create the query dynamically (http://drc.ideablade.com/xwiki/bin/view/Documentation/dynamic-query-create) in your custom verifier.
 
Regards,
   Silvio.
Back to Top
Vonzkie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 01-Aug-2011
Location: PH
Posts: 133
Post Options Post Options   Quote Vonzkie Quote  Post ReplyReply Direct Link To This Post Posted: 28-Jun-2012 at 2:19am
Hi,

Thanks for the info..
Is there a generic way of doing this? It seems that in every entity type that I want to perform such validations, I will create something like this? Is there some centralize solution?

Regards,
Von
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 27-Jun-2012 at 8:44am
Von,
 
You will need to query the database to ensure the value is unique. Try the followinging:
 
protected verride VerifierResult VerifyValue(object itemToVerify, object valueToVerify, TriggerContext triggerContext, VerifierContext verifierContext) {
  var mgr = new EntityManager();
  var value = (string)valueToVerify;
  var isUnique = !mgr.GetQuery<myEntityType>().Any(e => e.myProperty == value);
  return new VerifierResult(!isUnique );
}
 
Note that the above is for a synch environment.
Also, you might want to take a look in the DRC for more details in creating a custom verifier.
 
Regards,
   Silvio.


Edited by sbelini - 27-Jun-2012 at 8:46am
Back to Top
Vonzkie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 01-Aug-2011
Location: PH
Posts: 133
Post Options Post Options   Quote Vonzkie Quote  Post ReplyReply Direct Link To This Post Posted: 27-Jun-2012 at 1:37am
Hi,

Do you have a standard way of validating duplicate records based on some unique fields?

Thanks,
Von
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down