Race condition in Google Appsheet when updating row after created - race-condition

It seems I'm experiencing a race condition in Google Appsheet:
I've configured a Behavior in my form view: Once the form is saved -> run 'Data: set the values of some columns in this row' (edit one of the fields). Looking in the chrome developer tools, I see two calls are sent to AppSheet API - one to create the row and another to edit it:
The update is working correctly. Still, then there is a screen flickering, and the original value before the set data action overrides the edited value again. Eventually, the initial value is saved to the DB, not the new one.
My app is working against Postgres (RDS) DB
https://www.appsheet.com/api/template/<row_id>/table/<table_name>/row
https://www.appsheet.com/api/template/<row_id>/table/<table_name>/row/update

Related

My recordset returns only one record even though there are more one record in Microsoft Access

I am creating a form that loads all the information from the Activity_Table into the form. So basically when the user chooses the name of the Company from the Company_Name drop down, and selects the site from the Site_Name combo box, it is supposed to return the values from that site and put them into the form.
Basically one site can appear more than once in the Activity_Table. Yet, whenever the user selects the name of the site, it only returns one record. To make sure of this, I used the .Recordcount method to check how many records that will be retrieved.
So when you check the Activity table, the Site "Accra Mall - 630kva Gen 2 " appears 4 times, yet when you check the recordcount, it only says it appears Once. So because of this, I cannot move either forward or backwards to either the next or previous record.
To make sure that there was nothing wrong with my sql, I run the query in the Query Design and it produced all 4 records of "Accra Mall - 630kva Gen 2".
So there is nothing wrong with the sql statement. Can anyone help me out please?
This is when I choose the name of the site
We can see that it returns only One record here
Yet this is the amount of records it's supposed to produce(This was when I tried the sql code in the query design tab. It returns 4 records, Not 1). So the recordcount is supposed to be 4. Not One.
this is when I tried the sql to in the previous picture.
If I replicated your problem correctly then the answer is to set Data-Entry to no. Check your form properties. Under the data tab there is a data-entry property. set data-entry to no. From microsoft at https://support.microsoft.com/en-us/office/dataentry-property-f4236759-27f6-4fcd-abb0-4aa4acd8fe87 we get an explanation:
You can use the DataEntry property to specify whether a bound form opens to allow data entry only. The Data Entry property doesn't determine whether records can be added; it only determines whether existing records are displayed. Read/write Boolean.

Add A Row - Not adding a row to bottom when previous rows are hidden

I have an order form (hosted by Jotform.com) that's connected to a Google Sheet via the API through a company called Integromat.com. Everything has worked great for years but I received an email from Integromat.com on Friday that we were using a legacy version of the Google Sheets module and we needed to update before that legacy version stopped working.
I updated our modules (which I assume just updates the Google Sheets API?) and now I'm encountering a problem that I'm not sure how to fix. Integromat is claiming that "Unfortunately this behavior comes directly from Google Sheet's and we can't avoid it." but I question that.
My problem: The sheet that receives the order form data is updated properly so long as the very last row of filled data is unhidden. But we hide rows as orders are completed and if all the rows are hidden and a new order comes in a row is added at the top of the Sheet (row 2 since we have a header that's never hidden in row 1) which in turn throws off several other Sheets that are connected to the order sheet.
Before the update, the add a row function didn't care if rows were hidden or not. But since the update it's like it can't tell if data is contained in hidden rows or not and just proceeds to insert a new row at the top.
Is Integromat correct that this is now unavoidable? Or is there a solution that I can implement or tell them to implement?
The workaround for now will be that we don't hide orders in that sheet but that's not a great long-term solution for us.
The problem can be caused by the first cell of the caption. It seems like integromat (aka make) can't handle it and thinks there is no caption. Then it just adds the new entry as the first line. Once the very first cell in the title contains data, it should work again.

How do I add an auto-populated form record (created from another record) to a table in access?

I am populating a form with information from two other forms to create a new client record. From form 1 I get the CaseID which will tie the new client record back to the Case table. Form 2 lets me select a client from a list and pull information for some fields into the new record. These data populate Form 3 which appears to show a new record (then number at the bottom of the form is 1 more than currently exists in the table) But the ClientID field is blank - this is the unique key for the client records table. I cannot seem to get this field to increment and thus can't get the record to save to the table.
Based on various searches I've tried forcing the record to save but nothing happens... no errors nor new records. I've tried
If me.dirty then
me.dirty = false
end if
and
DoCmd.RunCommand acCmdSaveRecord
I assume I'm simply not truly initiating a new record even though the form suggests it is being created. What is the appropriate way to add the record, including which control I need to use to initiate the action (e.g., attach to the On_click() event of a button). Note that, sometimes the record will be perfectly fine as populated, and sometimes the user may need to edit one or more fields before saving the record. It is also plausible that occasionally a user will decide the record should not be added and thus will need to close without saving.
It turns out that the ClientID field in the test database I was provided is NOT an autonumber field as it will be in the live dB version. So I simply had to look up the max value in the table and add one. I will have to test the autoincrement when I get the true Dev environment set up with the actual database structure duplicated instead of the mockup I have been working on to create the work flow.

Updating DB sync with API - will not update to show when custom fields are changed to blank

The code I created takes data from Highrise API and imports into our MySQL database tables.
This doesn't go to and from the db to Highrise. It simply goes from Highrise to the DB when the sales reps click a "sync" button I created.
Everything works fine when they populate the Highrise custom fields and click Sync. The problem happens when they delete data from a custom field and click "Sync".
I have a loop that does this for each:
mysql_query("INSERT lld_listing_constants (client_hr_id, customvalue, unique_field_id, customglobalid) VALUES ('".addslashes($co_id_hr)."', '".addslashes($subjectdatainner->{'value'})."', '".addslashes($subjectdatainner->{'id'})."', '".addslashes($subjectdatainner->{'subject_field_id'})."')
ON DUPLICATE KEY UPDATE customvalue = '".addslashes($subjectdatainner->{'value'})."', customglobalid = '".addslashes($subjectdatainner->{'subject_field_id'})."'");
So it obviously will INSERT just fine.. or UPDATE if there is a duplicate.. but what if it suddenly becomes blank? How would I check if it's blank?
I think the problem is that pulling the API data - it doesn't return custom fields that are blank.
Generally you'll want to check for the presence of a field before saving its value. If the field exists, assign its value to a variable you pass to the DB query. If not, assign the value to null and make sure the DB query sets null in the database accordingly.

Access Query not updating fast enough

Im building a key inventory mgmt system. I've created a query that show's me keys currently not in use by identifying which keys have been returned, aren't lost or have never been rented. I copied this query into the look up field for key_id in my keyActivity table (used to record key sign outs). The issue is that the query does not update to provide available keys until the table keyActivity is closed and opened again
Example: I open keyActivity, indicate that key_id = 5 is lost. When I go to a new record and select the key to sign out, key_id = 5 is presented as being available. It is not until I close the table, open it again, that key = 5 is removed from the list.
Here you can see key 5 is indicated as lost in id 5 but in id 7 when selecting a key, 5 is available when it shouldn't be.
Is there anyway to fix this or set this up to work as intended. I plan on using forms to present all the information. Is there a form solution perhaps?
The suggestion you would be better off with a Form to change table data. It can be easily requery-ed to update the table according to the changes you make and to display the udpated data accordingly. Please also read on the given references for further info.
In terms of data updating and locks in a multi user environment this article could be helpful.
"Access is NOT a database server. It's a desktop database. It has been pushed to the limit to support mutli-user environments, but only in the sense that you can share the "back end" database across a network."
...
...
"Even the record locking is performed by the Front End. All of the front end
database applications share the "lock file" (a file with the same name as
the database file, but with the extension LDB); but that file is simply a
mechanism that the front ends use to determine which front end can make
changes to the database."
....
Here is a difference between requery and refresh:
Me.Requery forces the entire recordset (underlying data) for the form to reload. This means ALL of the records in your current form will reload. Your current position will be lost, so if you're sitting on record 10 of 100, you'll find yourself back on the first record. Me.Requery is essentially the same as closing and reopening the form. Any new records added by other concurrent users will be available. Likewise any records that have been deleted will disappear. Requery essentially "re-runs the query" that pulled the data into the form in the first place. You can also use requery to update the data in a list box or combo box.
Me.Refresh saves the current record that you're working on. It will also retrieve any changes (but not additions or deletions) to any records shown in the current form. Any calculations on the form (unbound fields) are recalculated. Refresh does NOT reload the recordset. You do not lose your position in the form (you stay on the current record). Any new records added by other users will not be shown.
Reference
MS Access - Write to Table Immediately After Changing Value in Form