Page 1 of 1

Records Disappearing on Orientation Change

PostPosted: Tue Apr 30, 2013 3:00 pm
by RMittelman
I have a database called MyBudget which contains, well, my budget. If it matters, there is also a linked database containing frequency records, such as "every week", "every month", etc. Don't think that is related to the problem, which is:

When I open the database, I see the 4 records I created. At the bottom, there's the button which says "Default View (4/4)". When I switch to landscape view, all of the records are gone. The button at the bottom says "Default View (0/4)".

The same thing happens if I open the database in landscape view, then switch to portrait view. All of the records are gone (or at least removed from the default view).

Any ideas what's going on here?

PS: Further strangeness: I have 4 records, "Salary", plus 3 expense records. All are visible in list records screen (except as mentioned above). If I view ANY of the records by tapping it from list screen, when I tap the "Back" button, the "Salary" record is gone. The button at bottom says "Default View (3/4)". Not only that, once the first record is gone, now I can successfully switch between portrait and landscape views. Still has first record missing, but they don't ALL disappear as mentioned above. A bit better, but still unusable.


Re: Records Disappearing on Orientation Change

PostPosted: Wed May 01, 2013 5:46 am
by Brian_Houghton

Thanks for posting. Very sorry to read about this!

Since the database will open, but is exhibiting problems, we need to determine whether a rebuild of the file will resolve the problem or not. To do this, we are going to go through the steps of:

- exporting the records in the database to a CSV file,
- creating a new database that uses the same structure (field names and types) as the original
- and populating the newly created databases by importing the CSV data that was exported in step one.

To proceed, do the following:

1. Make certain you have a copy of the database on your computer. You can download it using Desktop Connect or email the file to yourself.
2. Make certain you have a copy of HanDBase Desktop installed on your computer. If you don't already have it installed as a part of one of our optional add-ons, you can download a 30 day trial at
3. Open the misbehaving database in HanDBase Desktop (use the File - Open menu option).
4. Select the menu option File - Export.
5. Choose to export the data in CSV format, including field names on the first row.
6. Close the database.
7. Create a new database in HanDBase Desktop that uses the same field names and types as the original file.
8. Save the newly created database. Don't install it to your handheld yet.
9. With the newly created database still open in HanDBase Desktop, select the menu option File - Import.
10. Select the CSV file choose to append it to the database.

At this point you should see that the CSV file has populated the new database with records. Save the new database. Verify that all of the features work as they should. Then install the database to your handheld, and again verify that the features work as they should.

Sent from my Nexus 7 using Tapatalk 2

Re: Records Disappearing on Orientation Change

PostPosted: Wed May 01, 2013 12:05 pm
by RMittelman
Hi Brian,
Thanks for the detailed steps. I'm almost there.

I tried installing the Mac desktop plus version (so it would work with my iPhone), but couldn't make any database modifications. It seems only the Windows version lets you edit database properties. Since I use VMware Fusion on my Mac, I just downloaded the trial for Windows. I see a full-featured Mac version (wine), but don't know enough to decide on it. Would it be just as good as the Windows native version, or is it not worth the overhead, given I use Fusion anyway?

LSS: I installed Windows version, and rebuilt my databases (one main and one for DB popups). I had to change the order of 2 fields, so edited the CSV before importing, and everything works so far. Even my running and final income and expense totals work. One big problem: Every time I open either database, I see no records at all. I must click the Filter button, and even though none of the filters are checked as being active, I must click the Disable Filters button to see any records. Even if I save the database, when I exit and return the same thing happens. Bad enough when using a single database, but unusable when I click the popup button on a field with DB Popup type. The other DB opens with no records. Any way to fix this?


Re: Records Disappearing on Orientation Change

PostPosted: Wed May 01, 2013 1:34 pm
by dhaupert
Something strange is definitely happening. Perhaps you can send a copy of your database to and we can take a look and see if we see the same behavior?

Re: Records Disappearing on Orientation Change

PostPosted: Wed May 01, 2013 4:20 pm
by RMittelman
I have sent you an email with my 2 databases attached. At the time, I could not post a reply, so asked my questions in the email. Now the database works fine in the Windows version of HanDBase. However, I still have the original issue on the iPhone. I open the database there, and there are 33 records. When I rotate to landscape view, all of the records disappear. They're still there somewhere, because the Default View (0/33) is still visible at the bottom of the iPhone screen. Something is happening during the rotate operation. I thought there was a bug in the iPhone app, so I deleted the app from my iPhone, then downloaded it from the app store again. I sync'd my desktop with it, including installing the 2 new databases. Same problem with rotation. I notice that when I open the EZShop database, the issue does not occur. Therefore, maybe there is a setting on my new database that is causing this. Please advise.

Thanks so much...

PS: Noticed that when I open the smaller DB (MyBudget_Freq), the issue does NOT occur. Therefore, there is probably something wrong with the main DB (MyBudget). This may be related to the complexity of its structure. Please see the second question in my email, which describes how I had to design it in order to get grand totals of income and expense items.

Re: Records Disappearing on Orientation Change

PostPosted: Thu May 02, 2013 11:33 am
by RMittelman
Further Information:

The problem is definitely related to the 2 Relationship fields at the end of the DB, TotalIncome and TotalExpense. As mentioned earlier, they are using this same DB as the "Other DB", and getting that running total from the last record. When (on the iPhone) I change them to "Not Used", the rotation problem goes away. I guess you don't support relationships to the same database? Unfortunately, I can't think of any other way to achieve my goal of having a budget DB which shows these totals as you add income and expense items. The running total fields work, but don't make much sense except on the last record.

If I used forms, would it be possible to have a master-detail type form (like an order entry form), with one set of fields on the top just showing the running totals from the LAST record, then a detail section showing each record in the DB (like the list view screen)?

Please help... This can't be such an unusual request, can it? If using the same DB as the "Other DB" is unsupported, can this be fixed in a future release? It seems like a good way to get totals.


Re: Records Disappearing on Orientation Change

PostPosted: Fri May 03, 2013 8:34 am
by dhaupert
Hi Ron,

Thanks for your followup. Indeed what is happening is related to the relationship field and what is known as a circular reference. Here's a brief explanation:

The relationship field doesn't cache or store any value so whenever it's value needs to be shown or used in a calculation, it has to be looked up.
This lookup involves querying the database to find all matching records, doing a recalculation of them if needed, and then grabbing either the first or last value.

If the relationship field is used for or in a calculation and the recalc happens, then each record is going to be reloading it's values and recalculating the running totals. Since the very same relationship field is in this database (since it's the same exact table), the lookup will start again- for each record's relationship, it will then do another query which will then spawn another recalc, which will then spawn another query, etc. As you can seen this causes an infinite loop.

Normally this will crash a program but I put in some stops to prevent this from happening- namely after x levels of queries, the program does not create a new query.

In your case, the blank records are a result of this catch all happening and it shows the last failed query in that list view as a result (which shows 0 records).

Thus you can't reference the same table in a relationship if there are any sort of running total calculations in the table.

Now in the old days I used to support this, but this is because a relationship would not perform a recalc. This means you could grab a value but it would not be the correct value on a running total calculation. Many customers requested a way to have this changed so that they could run totals on related records and show that total in the relationship field, and I did make that change about 2 years ago on iOS.

Unfortunately I'm not smart enough to find a solution to this! If it were a fixed type of format in an app, I could use some logic to prevent this from being a problem, but the nature of HanDBase is that there can be any set of fields and used for any purpose, so I don't have that luxury.

Re: Records Disappearing on Orientation Change

PostPosted: Fri May 03, 2013 11:12 am
by RMittelman
Hi Dave,

Thanks for taking the time to explain. I didn't realize I would be in for unlimited repetitions by linking to the same table. I've been a programmer for many years, and normally use SQL-type databases, which will allow this type of reference. I guess I just need to become more familiar with HanDBase operation, and find a better way to do this.

Actually, I'm trying to obtain my results with a parent-child table relationship, but having issues figuring out both linking and relationship fields between the same 2 DBs (one to group the detail records to a "parent" record, and the other to get total income or total expenses displayed on the parent record).

I have posted my problems in another question on this same forum.

Thanks again!

Re: Records Disappearing on Orientation Change

PostPosted: Fri May 03, 2013 2:22 pm
by dhaupert
What is different in HanDBase is that calculations are actual field types, whereas in other systems the calculations are done as part of the query (and done after the data set is determined). So there is no recursion issues with them. I made calc and conditional fields as field types because I thought they made more sense there to a non-experienced database user. It is ironic that it causes trouble to advanced DBMS users as a byproduct ;)