Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Applying NoDuplicate within GridControl
Applying NoDuplicate within GridControl [message #9609] Mon, 21 May 2007 00:01 Go to next message
mellithy is currently offline  mellithy
Messages: 4
Registered: May 2007
Junior Member
In "Home Budget" example I'm trying to use NoDuplicate to Month and group input but I do not how?

I used a Sqlite external program and added an extra index to the DATES and GROUPS tables with an extern program.

I used the following statements
CREATE UNIQUE INDEX DT_index ON DATES(DT ASC);
CREATE UNIQUE INDEX GR_index ON GROUPS(NAME ASC);

But "Home Budget" crashs during input duplicate row with the following message :
Assertion failed in C:\upp\uppsrc\CtrlCore\Win32Wnd.cpp, line 548
0

Re: Applying NoDuplicate within GridControl [message #9610 is a reply to message #9609] Mon, 21 May 2007 08:44 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

Thanks. I'll try to find out what's going on today.
Re: Applying NoDuplicate within GridControl [message #9622 is a reply to message #9610] Tue, 22 May 2007 10:56 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

I have created indexes but I could not repeat the error. What exactely you do?

PS: GridCtrl from latest dev is broken. HomeBudget couldn't store records in database. Now it's fixed.
Re: Applying NoDuplicate within GridControl [message #9629 is a reply to message #9609] Tue, 22 May 2007 15:35 Go to previous messageGo to next message
mellithy is currently offline  mellithy
Messages: 4
Registered: May 2007
Junior Member
Under Month add a record let's say 'May 2007' this works.
Add next record but this time choose 'May 2007' again.

You will generate the exception error, instead of getting a message telling that 'May 2007' already exist.

Without an indexed database you will be able to generate many records for the same month. Which I tried to prevent.

Thanks in advance.
Re: Applying NoDuplicate within GridControl [message #9631 is a reply to message #9629] Tue, 22 May 2007 21:49 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

Thanks! Fixed. The problem was global try {} catch(). If thrown object comes from open window/nested dialog it ends with assertion you wrote.
Re: Applying NoDuplicate within GridControl [message #9637 is a reply to message #9631] Wed, 23 May 2007 04:30 Go to previous messageGo to next message
mellithy is currently offline  mellithy
Messages: 4
Registered: May 2007
Junior Member
Great!

The question now how to deal with double records values to an unique indexed column fields within GridCtrl.

In other words how to prevent creating or altering records with duplicate values.

By example giving an error code back for 'Failed to add or modify record <value> or <value> already exist in a 'unique' indexed column.
Re: Applying NoDuplicate within GridControl [message #9639 is a reply to message #9637] Wed, 23 May 2007 08:26 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

Quote:

In other words how to prevent creating or altering records with duplicate value

I modified HomeBudget to be able to do that. It uses GridCtrl's CancelInsert/CancelUpdate in grid callbacks if database refuse commiting new/updated record. Now it shows sql error, but you can examine a sql error code and if it is index violation you can show "Error: duplicate record".
Re: Applying NoDuplicate within GridControl [message #9644 is a reply to message #9639] Wed, 23 May 2007 12:53 Go to previous message
mellithy is currently offline  mellithy
Messages: 4
Registered: May 2007
Junior Member
Thanks a lot.
Previous Topic: DropList multiple selection
Next Topic: Hide arrayctrl column?
Goto Forum:
  


Current Time: Sun Apr 28 22:32:20 CEST 2024

Total time taken to generate the page: 0.03356 seconds