Page 1 of 1

Missing data with revDatabaseColumnNamed [SOLVED]

Posted: Sun Feb 26, 2023 12:17 am
by Emily-Elizabeth
It seems that data of the last column of the last record of a SQLite database isn't being returned when using revDatabaseColumnNamed. I've searched the forums and not seeing anyone else with this issue, so the issue might be related to my code.

Code: Select all

command UpdateUserFieldControlContent stackLongID
   local databaseID
   put the cDatabaseID of stackLongID into databaseID
   local recordSetID
   put the cRecordSetID of stackLongID into recordSetID
   local recordSetCount
   put DBRecordSetCount(recordSetID) into recordSetCount
   local numberOfControls
   put the number of controls of stackLongID into numberOfControls  
   if (recordSetID is a number) then
      repeat with i = 1 to numberOfControls
         if (char 1 to 3 of the short name of control i <> "dbd") then
            if (databaseID <> EMPTY) AND (recordSetID <> EMPTY) AND (the cToolType of control i <> "label") then
               put revDatabaseColumnNamed(recordSetID, "dbdID") & LF & \
                     revDatabaseColumnNamed(recordSetID, "field_id_1039")
               set the text of control i to (revDatabaseColumnNamed(recordSetID, the cName of control i))  // where cName is "field_id_1039" and 
               // shows the correct values for the previous entries
            end if
         end if
      end repeat
   end if
end UpdateUserFieldControlContent
I'm using the OpenSource version of LiveCode 9.6.3 build 15543 on macOS

Re: Missing data with revDatabaseColumnNamed

Posted: Sun Feb 26, 2023 12:29 am
by Emily-Elizabeth
Screenshot 2023-02-25 at 18.26.54.png
The data is in the database, but when I ask for the data I only get the dbdID. field_id_1039 and field_id_1040 appear as empty (for dbdID 5, the other four IDs work properly)

Re: Missing data with revDatabaseColumnNamed

Posted: Sun Feb 26, 2023 7:24 pm
by jacque
I'm not sure we can get the number of controls in a stack. What happens if you get the number of controls in the card?

Re: Missing data with revDatabaseColumnNamed

Posted: Sun Feb 26, 2023 8:13 pm
by Emily-Elizabeth
I think because there is the one card, it does work. There are 36 controls before it reaches the control added by the user and it does show the user data, except the last entry.

Re: Missing data with revDatabaseColumnNamed

Posted: Tue Feb 28, 2023 5:04 am
by Emily-Elizabeth
The issue was due to the record set being created before the data was added to the database. Creating a new record set solved the issue.