Unique field duplicates value

For HanDBase related topics that are not specific to one platform.

Unique field duplicates value

Postby chungfoulds » Tue Apr 12, 2016 8:52 am

I have an invoice database with a unique field that I use to identify each invoice. On doing my accounts I have found that the unique field has generated the same ID number on several occasions. Not all the time, just occasionally, has ahyone experienced similar behaviour.
chungfoulds
 
Posts: 15
Joined: Tue Jul 27, 2010 4:15 pm

Re: Unique field duplicates value

Postby Treanot » Tue Apr 12, 2016 8:31 pm

Yes.
I ran into this problem and there were several answers already in the forums that explains the reason why and some solutions. I also tried the generating a unique number using the date and time then dividing it by a number technique, also explain in this forum, but found the number was too long. My solution in generating a ID number was to keep a count using these 3 fields:
Startvalue calculated (id+increase)
id integer start value of precious Startvalue
Increase integer static value of 1

There are still several issue with this. The first record will be 0 and you need to sort by ID number so that the last highest ID record starts the count. You will see what I mean after you start using it.

Of course this gets more complicated if you want to use multiple Devices simultaneously.
That is a different question completely.

Good luck.
Treanot
 
Posts: 39
Joined: Mon Feb 08, 2010 3:15 pm

Re: Unique field duplicates value

Postby chungfoulds » Wed Apr 13, 2016 11:43 am

Thanks, I had done a search but it came up blank, found some replies today though! They are way more complicated than I need as I only have one device that I input on. It seems that the problem may be related to 'copy to new' command and/or using different views of a single database and entering data in those views as opposed to the base view, together with adding new records with backdated dates. In short, messing with the database !! thanks for the comments
chungfoulds
 
Posts: 15
Joined: Tue Jul 27, 2010 4:15 pm

Re: Unique field duplicates value

Postby Brian_Houghton » Sun Apr 17, 2016 12:51 pm

The unique field can unfortunately generate duplicate values in certain scenarios and is considered a "legacy" field, left in for compatibility purposes but not fully accurate. The reason it can generate duplicate values is due to the way the internals of HanDBase generates values.

If you are using iOS, you may want to consider combining a series of values using the concatenate feature of the external field. Doing so you can add the values of an integer that adds 1 to itself with each new record, add the time the record was created, add the date the record was created and more based on your needs. Doing so will give you a unique number for each of your records.
Kind Regards,
Brian Houghton, DDH Software
Brian_Houghton
 
Posts: 2246
Joined: Wed May 20, 2009 8:30 am

Re: Unique field duplicates value

Postby Treanot » Mon Apr 18, 2016 10:43 am

I will add that the PC version does not support concatenate field. If you do any key entry on the Computer you will have a "null" field. It does export the value from IOS to PC and you will have a field value when you sync . But the PC desktop does not support combining external field and thus you can not join field on the desktop it really a feature that is missed. The work around is if combine field is blank then then value else not combined value (off the top of my head I don't remember).
Then you start running into issues that the conditional statements don't show up live until after the entry in saved, or an external Popup is prior to the condition.
Treanot
 
Posts: 39
Joined: Mon Feb 08, 2010 3:15 pm


Return to HanDBase General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests