startup option changes after sync

Discussion of the version of HanDBase that runs on the iPhone and iPod touch devices. This includes the synchronization conduits as well.

startup option changes after sync

Postby glenwf » Sat Dec 29, 2018 12:45 pm

Question about changing startup option.
The settings I'm using are:
--Recall Last View Selected
--Edit Last Edited Record

The above settings work great, until I sysc with my computer (MacBook Pro - up to date OSX El Capitan).
After syncing with the HanDBase Desktop 4 and I open a database on my iPhone I get a random??? record opening up for editing. So a record does come up for editing, just not the one I last edited. Not even the last one I edited on the desktop HanDBase. Sometimes it even seems random. Of course once I close that record and open the one I want to edit and close it things go back to the way they are supposed to, until I sync with desktop again.

Is this a bug?

iPhone 5s. HanDBase 4.9.079

Thanks.
glenwf
 
Posts: 199
Joined: Wed May 20, 2009 5:34 pm
Location: Roseville, CA

Re: startup option changes after sync

Postby ddhsoftwareadmin » Sat Jan 12, 2019 11:52 am

Hi there,

Sorry for the delayed reply! I'm guessing that you have sorting enabled on your database, is that right? When a sync happens after the sync is complete the database is resorted on the next open. If you have any records where the sort is a tie (eg, lets say you're sorting by date and have two or more records with the same date) there is a chance that the order has swapped. The sorting we use is not a stable sort, so the order can change for any records with a tie if you sort the same database twice or more times.

If the above is true, and we're storing the record index of the one you last edited, it is possible it could change after a sync.

One improvement I have thought about is rather than storing just the index, I could store the record unique ID, then when restoring your state, if the last record index doesn't have a matching ID, I can search for it at that time. But this has not been implemented on any of the HanDBase versions thus far.
ddhsoftwareadmin
Site Admin
 
Posts: 421
Joined: Tue Dec 09, 2008 2:13 pm

Re: startup option changes after sync

Postby glenwf » Sat Jan 12, 2019 12:25 pm

Thanks for the reply. Yes, I have several views and each view is sorted differently.

At least I know it isn't a bug, just a behavior not under control. That is better than a bug.
glenwf
 
Posts: 199
Joined: Wed May 20, 2009 5:34 pm
Location: Roseville, CA

Re: startup option changes after sync

Postby curtterp » Sun Jan 13, 2019 9:46 am

ddhsoftwareadmin wrote:Hi there,

Sorry for the delayed reply! I'm guessing that you have sorting enabled on your database, is that right? When a sync happens after the sync is complete the database is resorted on the next open. If you have any records where the sort is a tie (eg, lets say you're sorting by date and have two or more records with the same date) there is a chance that the order has swapped. The sorting we use is not a stable sort, so the order can change for any records with a tie if you sort the same database twice or more times.

If the above is true, and we're storing the record index of the one you last edited, it is possible it could change after a sync.

One improvement I have thought about is rather than storing just the index, I could store the record unique ID, then when restoring your state, if the last record index doesn't have a matching ID, I can search for it at that time. But this has not been implemented on any of the HanDBase versions thus far.


You can stabilize the sort easily. The sort function allows you to sort on 3 fields, so if you sort on Date, you can sort on Time as a secondary sort. If you sort on sometime else, you can use Date and Time to break all ties. The chances of having the same Date and Time on 2 records is very very small.

If you are already sorting on 2 fields that are not Date and Time, you can use a calculated field to Add Date and Time fields together. This creates one field to use the Date and Time fields. If you are worried about having the same Date and Time on 2 records, then add a Unique Field to the Database, and add that into the calculated field with Date and Time.

This should work on 95%+ of use cases. There might be a couple of use cases out there that I am not thinking of that might not be as stable, but for most people, this will work.

PS - Most times I use the Date and Time of Record Added. If I want to see what records were last updated, I use a separate Date and Time for Record Last Modified. For sorting, I would use a calculated field for each date/time set and put those in separate views.

PSS - If you have a date field, ALWAYS have a time field.

PSSS - Unique field will cause problems with syncing to Access Databases. If you use the Unique field and think you might sync to Access, use a calculated field to add 1 to the Unique field so you don't lose your unique field when syncing.
Have a good day

Curt
I am not a DDHSoftware employee, just a long time HanDBase user.... from Palm to Windows Mobile to Android, to iOS. Thanks to DDH, the database files transferred to each platform without a problem.
curtterp
 
Posts: 740
Joined: Tue May 26, 2009 6:41 pm
Location: Northern IL

Re: startup option changes after sync

Postby glenwf » Sun Jan 13, 2019 12:33 pm

Thanks, I see the value of the date + time fields...
Question: I have over 1000 entries, so using the date + time field ADDED isn't possible, unless I enter that the next time I use the record which might work.

IF one used the date + time of Last Used I don't see how that would help. Last Used on a handheld would give one number, then after a sync to desktop and used on the desktop the date and time would change and then after a sync back to handheld the sort would be changed if I'm not mistaken. So a stable date+time number would be preferable so it wouldn't change after syncing.

This will work only if the file has the ability to add another item to the sort to the view. Fortunately in this case I have an empty sort I can use. In a lot of my files I'm using all 3 sort options already. It seems some files get more and more views added (to the max) and I need all 3 sort options already.

Thanks for the help.
glenwf
 
Posts: 199
Joined: Wed May 20, 2009 5:34 pm
Location: Roseville, CA

Re: startup option changes after sync

Postby curtterp » Sun Jan 13, 2019 4:47 pm

glenwf wrote:Thanks, I see the value of the date + time fields...
Question: I have over 1000 entries, so using the date + time field ADDED isn't possible, unless I enter that the next time I use the record which might work.


IF one used the date + time of Last Used I don't see how that would help. Last Used on a handheld would give one number, then after a sync to desktop and used on the desktop the date and time would change and then after a sync back to handheld the sort would be changed if I'm not mistaken. So a stable date+time number would be preferable so it wouldn't change after syncing.

This will work only if the file has the ability to add another item to the sort to the view. Fortunately in this case I have an empty sort I can use. In a lot of my files I'm using all 3 sort options already. It seems some files get more and more views added (to the max) and I need all 3 sort options already.

Thanks for the help.

You could use date last Modified, which when you open a record/then save it, it will add the date and time.

Just note that every time you open/save a record, the date and time will change. If you are only interested in having a sort to see which records you last used, this works very well.
Have a good day

Curt
I am not a DDHSoftware employee, just a long time HanDBase user.... from Palm to Windows Mobile to Android, to iOS. Thanks to DDH, the database files transferred to each platform without a problem.
curtterp
 
Posts: 740
Joined: Tue May 26, 2009 6:41 pm
Location: Northern IL


Return to HanDBase for iPhone and iPod touch

Who is online

Users browsing this forum: Google Feedfetcher and 1 guest