Downrecord deletes data

I have a very strange problem that I just cannot solve. I have a large database file that I converted from Panorama 6 to Panorama X. There are two text list objects containing choices for two data fields (field names are: ProductInfused and Treat), there is a third data field (ProdwTreat) that will display a result based on the choices. Within a record I make the choices and all the fields display correctly. However, when I go back into the database to update information in the records, when I go down a record, using either the arrow keys or the downrecord arrows to move to the next record, the data in the two choice fields blanks out. The third field that is calculated from the two choice entries stays filled. This does not happen if I go up one record and if I go down more than one record only the first record I go down to blanks the data fields. The choice lists are programed in the Text List Objects in the Formula tab, not in the datasheet. The Procedure for calculating the value of the third field is in the second Text List Object since the data in the second field (Treat) is needed for the formula.

This is vexing to say the least. I read the other two topics on downrecord problems and it does not seem to be the same issue. The problem occurs when I have only the form window open that contains the Text List Objects.

Help!

No parentheses.

Carolyn Taylor. Sent from my iPad

I have another issue with this same database that I have done a lot of troubleshooting on, without success. I use both .Initialize and .ModifyRecord procedures in the database. Unlike my other database files, when I open the problem database the .Initialize procedure is disrupted. I create a fileglobal variable in .Initialize to identify the individual who is using the database which I call vTechID. Before the code can even run to enter the data for vTechID I get errors saying the field or variable vTechID does not exist and .Initialize does not run. I use the vTechID variable in only one other place, which is to identify who modified the record when .ModifyRecord is triggered. The field ModTech is defined by the variable vTechID in .ModifyRecord. I did some testing by renaming the variable, first in .Initialize, then in .ModifyRecord and found the error that pops up is from .ModifyRecord. Now this happens when the database first opens before any changes that should trigger .ModifyRecord have occurred. I opened the data sheet and what I find is that .ModifyRecord is being trigged just by being in the record. This is not the case for my other databases where .ModifyRecord is only triggered by making a change in the record. I can find no settings for controlling this behavior and have deleted and recreated .ModifyRecord without changing this behavior. I am not sure how this might be related to my disappearing data problem, but it could be. Any suggestions would be appreciated.

It sounds like you are trying to display a dialog in the .Initialize code, for example using the gettext statement. If that is the case, this is not allowed in Panorama X.

I did not realize that. I have been logging in the user in the .Initialize procedure for all my PanX databases without this problem. I have used gettext, gettextdialog, and recently supergettext for this purpose. I assume none of those should work? Still why is .ModifyRecord triggered by simply being in the record?

Carolyn Taylor. Sent from my iPad

I have now changed .Initialize to open a new window that I made for the user to login. The initialize code does not require any user input or dialogs, that is now in the LogIn code trigger by a button. However, the problem remains that merely opening the file to a record updates the fields that record the login identity, date, and time the last change was made. Since the variable capturing the login identity is only created after the user logins in I am presented with an error message.

In searching for .ModifyRecord in this forum and in the help files, I find one response that said that .ModifyRecord was triggered by just being in the record, but elsewhere it states that .ModifyRecord is only triggered if the record is changed, which is the behavior I want. Also, this problem database is the only one that is behaving like this. I just need to know if this behavior can be controlled. Thanks.

The .ModifyRecord procedure is only triggered when a value is assigned to a field. Notice that this occurs even if the value assigned is the same as the value already in the field, so strictly speaking a modification isn’t required. However simply “being on” a record does not trigger the procedure. Keep in mind that some types of form objects, like Text Lists, can assign a value to a field simply by clicking on the object.

I have attached a simple test database that shows my problem. The database has 9 records. There is one form window with two text list objects. One is a choice of Animals, the other a choice of Activities. The Activities choice text list has a procedure to generate the data field AnimalwActivity which a combination of the two choices. I also display the date and time generated from .ModifyRecord on the form.

The behavior I see is that upon opening the database, the date and time of the first record changes to the current date and time. If I move through the records with the arrow keys or the up and down icons the date and time change. It does not matter what field I am in when moving up or down the records .ModifyRecord is triggered.

Also I have to select the Activity twice in the Activity text list object to trigger the formula. I would prefer it be triggered after the click release. And of course I would prefer that .ModifyRecord is not triggered when not actually entering new data.

(Attachment Test.pandb.zip is missing)

The Discourse server doesn’t support attachments. However, since you submitted this via email, I was able to fish your attachment out.

As I suspected it might, your database displays data using Text Lists. Unfortunately, the Apple code used to display these lists thinks simply displaying data is the same as modifying it. There is no way to stop this other than to not use Apple’s code, and that would have huge drawbacks. So if you use Text Lists or Matrixes in your forms, you must live with the fact that .ModifyRecord will be called whenever a record is displayed. In fact, the .ModifyRecord feature is pretty much useless if your form contains these types of objects.

I solved my problem by using a variable in the Text List instead of the datafield. Once the option is selected the variable was used to define the field. That stops the .ModifyRecord triggering. I still am not sure of how this issue was causing data to be deleted when moving down one record, but that problem too has gone away.