by craig-c » Fri Feb 27, 2009 2:02 pm
Hi,
I have spent a bit more time looking into this problem since yesterday, and as a result have found what looks like a bug in Servoy.
Basically, I'm developing my solution on a Mac and I'm using time machine to back everything up every hour. This means that I could go back to yesterday, just before the problem occurred.
This enabled me to return the developer to the way it was yesterday afternoon, before the calculations got erased. This meant that I could then go through the same process again to see what happened. I will explain the steps I took yesterday (and this morning) below. These steps led to the loss of all my invoice calculations on both occasions.
1. In my solution I have a list view form that lists quotes. I also have a more or less identical list view form that lists invoices. These lists enable the user to access more detailed forms for individual quotes and invoices. I have separate tables and forms for quotes and invoices.
Anyway, yesterday I decided that I wanted to set up a rowBGColorCalculation for both of these list forms. This was so that I could have alternate colours in the rows in my lists, plus I could also give the selected row a unique colour to indicate its selection.
I therefore went through the process of changing my quote list form so that it could show these row colours. This involved making various modifications to the form. These included making all the fields in the quote list form transparent. I also made other minor modifications to the form. I then went to the rowBGColorCalculation property in the quote list form. I double clicked on its value field which brought up the 'Select script' pop-up. I then clicked on the create calculation button at the bottom of the pop-up. I then typed in the name for my new calculation. Finally, I went to the new calculation and typed in some code. I then (after saving) had a fully functional quote list form that showed row colours in the way that I had selected.
These steps all went without any problems. I didn't re-do these steps this morning because they had already been completed in the back up that I retrieved from time machine.
However, the following steps were what lead to the loss of all my invoice calculations. I also went through these steps again this morning, after retrieving the back up, and exactly the same problem occurred again (all my invoice calculations got erased - again).
2. I duplicated the quote list form. I renamed that new form 'invoice'. I changed its table to the invoice table. I also changed the data providers in its various fields, so that they corresponded to fields in the invoice table. I also changed the code in the forms methods so that it worked on invoices instead of quotes (I don't think that is an issue regarding this problem, but just thought I'd mention it to cover everything that I did).
FInally, I went to the rowBGColorCalculation property in the new invoice list form. I went through the same steps as discussed above: (creating a calculation for setting up the row colours). However, after typing in the name for the new calculation, I clicked the 'OK' button. This is when everything went wrong. To start with the form I was working on suddenly disappeared from the developer, even though it was the open (and visible) form when I clicked the 'OK' button. Also, the form wasn't available in the developer/workspace anymore. It had vanished without a trace. I had to shut down and then restart the developer to get it back. Also, the new calculation I had created had erased (overwritten) all of the other calculations in my invoice table (there were more than 30 of them, spanning many lines).
When this happened yesterday I was working on my own, so have no one else to confirm what I did. However, this morning I went through the same process with Bevil here in the office. He saw everything that I did, and he couldn't see anything wrong in what I did either.
From what I've said above, you should be able to see that this isn't a problem that always occurs with the rowBGColorCalculation property. After all I did the same thing with my quote list form and that didn't give the same problem. However, I have done the same thing with my invoice list form on two separate occasions, and the same problem occurred both times.
I am more than willing to send you exports, etc of the solution if you want to have a look at them. I can obviously create the the calculation through the table instead, and (hopefully) this will avoid the same problem happening again.
Also, previously, you said that you hadn't seen this sort of thing happening before. Maybe this is because you always create your calculations via the tables, instead of through a forms properties. Maybe that's why this hasn't become an issue yet. This is because most Servoy developers probably create their calculations via the tables, so don't really test this other approach out.
Craig