Check if FusiontableControl insert query successfully uploaded before proceeding - google-fusion-tables

So basically, I am using App Inventor with fusion tables and I have a while loop that uploads every single row of the query and a counter that counts the number of successfully uploaded rows to Google fusion tables.
The loop is like:
while counter <= databaselength
(
call insertquery
counter=counter+1
)
I need to check if every row of the query was successfully uploaded inside the while loop before setting counter=counter+1
Any Suggestions ?

The fusiontable controls in App Inventor work asynchronously, which means, you should use this workflow:(pseudocode)
insert data (one row)
after inserting one row you can check in the fusiontable controls got result event, if the insert was successful and if there are more data to insert
if yes, insert data (next row)
if no: end
In the following example https://puravidaapps.com/filebyfile.php you can learn how to work with asynchronous components. The example however uses the web component. Yes, it's different, but it uses the same logic as mentioned in the pseudo code above. Now use this pseudo code together with the fusiontable controls.

Related

Filter GetRows on GoogleSheet Document via Logic Apps

I am reading from a google sheet of 100,000+ records but I want to load only the records after a certain date. ( so applying filter ) . But I haven't been able to accomplish that as I do not know how to access the column name without using foreach.
Here is what the data looks like from the googlesheet
So basically, I would like to filter the records something like this.
Timestamp ge '10/13/2021' so it will only return records for 10/13/2021 and 10/14/2021... etc.
Is this possible to do that? If not, what is the best recommended way to approach this issue as i just wanted to load daily records to sql db in the next step.
The Get rows action of the Google Sheets connector doesn't support filtering. You can only specify how many rows you want returned, and how many rows you want to skip. E.g. if you have 100,000 rows in your sheet, you can easily get the rows between 90,001 and 90,200, should you wish to do so.
While you can't use this connector to retrieve filtered data from Google Sheets, you can use the Filter array action to filter the retrieved data as you wish.
You might still need to use the For each loop to retrieve and filter data in chunks.

Google Sheets API: Append cells and add developer metadata atomically?

I want to append a row of cells to a google sheet and also attach some developer metadata to that row.
In the Google Sheets v4 API, I know you can use batchUpdate to append a row with the appendCells request, and you can add developer metadata using the createDeveloperMetadata request.
My issue is that I wanna set some developer metadata to specifically the newly appended cells atomically. There's not really a way to specifically ensure the range of the newly added row in createDeveloperMetadata, and if I use two different requests, someone else may insert a row between those requests which could shift all the rows, causing the appended cell's range to be pointing to an incorrect row.
Is there a way to attach developer metadata to a newly added cell atomically?
Answer:
There is not currently way of ensuring that the sheet structure hasn't changed between requests.
More Information:
Your The best option, I think, is to make two sequential requests in the same batch. Though this isn't foolproof, in very unlucky circumstances. Even inserting the row directly using an UpdateCellsRequest isn't foolproof either, as simply knowing which row you inserted the data doesn't exclude the possibility that someone else may insert/delete a row before it between the two requests.
Feature Request:
You can however let Google know that this is a feature that is important for the Sheets API and that you would like to request they implement it. Google's Issue Tracker is a place for developers to report issues and make feature requests for their development services.
The page to file a Feature Request for the Google Sheets API is here.
References:
Requests - UpdateCellsRequest | Sheets API | Google Developers
Requests - AppendCellsRequest | Sheets API | Google Developers
The solution I figured out was essentially:
Fetch the dimensions of the sheet
Perform a batch update with insertDimension, updateCells, and createDeveloperMetadata all performed for the same sheet dimension index at the end of the sheet
This basically ensures that the dimension index will point to the same row for all 3 operations in the batch update, and if the index points out of bounds, all 3 operations will fail

Reorganizing Google Sheets data dynamically

I'm currently working with Google Sheets to import data from Contact Form 7 in Wordpress. All the data is coming over fine, but I wanted to see about formatting it in more user friendly fashion. I've simplified the example a bit, but the gist of the form I have created allows the user to request multiple versions of a graphic file with different wording as needed, up to 5(my example has just 2 for simplicity sake).
All the data is imported using the CF7 variables and ideally I wanted to clean this up a bit. What I had thought of as a solution was creating a second sheet that pulls in this data submitted in the first sheet into a more user friendly format, as I intended to use this as a work form for a designer to create the requested graphic once the data is received. With each request the name/department/email/date all stay the same, but I'd like to display the version and line 1 and 2 data on another line. Is it possible to reorganize data like this on the fly, so when a new form is submitted and adds data to sheet 1, sheet 2 would then update with the properly formatted info?
Is this even possible to do? I did some looking online, but didn't anything that really related to this type of data manipulation.
Solution:
Here's what ended up working for my example
=ArrayFormula(QUERY({
Sheet1!A2:D,Sheet1!E2:G,ROW(Sheet1!A2:A);
IFERROR(LEN(Sheet1!A2:D)/0),Sheet1!H2:J,ROW(Sheet1!A2:A);
IFERROR(LEN(Sheet1!A2:D)/0),Sheet1!K2:M,ROW(Sheet1!A2:A);
IFERROR(LEN(Sheet1!A2:D)/0),Sheet1!N2:P,ROW(Sheet1!A2:A);
IFERROR(LEN(Sheet1!A2:D)/0),Sheet1!Q2:S,ROW(Sheet1!A2:A)
},"select Col1,Col2,Col3,Col4,Col5,Col6,Col7 where Col5<>'' order by Col8",1))
Yes, it's possible.
One way is to use arrays and the QUERY function.
For simplicity, let say that
Columns A and B have the general information of the order
Columns C and D have the data for version 1
Columns E and F have the data for version 2
Columns G and H have the data for version 3
On the output sheet, add the headers.
Below of them add a formula like the following:
=ArrayFormula(QUERY({A2:B,C2:D,ROW(A2:A);IFERROR(LEN(A2:B)/0),E2:F,ROW(A2:A);IFERROR(LEN(A2:B)/0),G2:H,ROW(A2:A)},"select Col1,Col2,Col3,Col4 where Col3<>'' order by Col5"))
References start on row 2 to skip the headers to avoid to include them on the output sheet.
ROW(A2:A) is used to keep the order
IFERROR(LEN(A2:B)/0) is a "trick" used to "hide" the order (general information) data for the second and following rows for the same order. On the select parameter of the QUERY function, it's referrey as Col5 on the order by clause.
It's assumed that lookup-choice-1 will never be empty.
NOTES:
If more columns were added, the column numbers should be updated accordingly
Don't use the order by clause to sort the result by the general information columns because the "trick" to hide the "labels". If you need to apply a sort, do it' before applying the above formula, you could do this by sorting the source range through the Data > Sort range... feature, so the data is sorted before it's transformed by the above formula.
See also
Sort and filter your data, an official help article describing Data > Sort range...

Manual entries in google spreadsheet do not match when the data gets updated

I have a google spreadsheet which have some columns of data written through a python script. At the end of the last data column I have added three more columns manually and data for those three columns would be entered manually. Python script would run daily, thus updating the data in the spreadsheet. My issue is whenever I run the script to update the data, the data in the last three manual columns gets jumbled. This is because the order of the data returned by the sql query from the script is different everytime. We can use order by to keep the order same but if new rows are added or the existing rows are deleted from the db then this would also not work.
As stated in this related thread, I think it's an expected behavior because the imported data is dynamic and the data you are adding are static.
The idea is that you don't add any columns to the Sheet that receives the imported data as this data is dynamic.
You need to create a new Sheet and select the data from the Sheet that has the imported data.
The Notes Sheet will need you to select the imported data by the order number in this case. The other columns of data will then be extracted from the ImportedData Sheet using the =vlookup() function and displayed and then you would enter the required note for that record.
You may check the link above for more information.

Hyperlink from a count query to extract associated data in access

I have a Count query that uses multiple criteria to produce a result looking like:
count ID
1 "abc"
4 "bcd"
5 "def"
1 "cde"
This shows how many times the ID appears in a given database. The datasource is through an odbc connection that updates automatically. So the ID values change everytime it is opened. I would like to try to turn the unique ID or the associated count into a hyperlink that when clicked will return all information involved in the count (*note the database has much more information associated with the ID's than is counted, a date range of the previous three months is applied.) Can this be done simply?
Database format:
ID Instance Device DateBeg DateEnd
Thanks in advance,
LP
The short version -
This should be simple to do using a report (but could also be done using a form I will be explaining how to do a report for this version). You would just make a report that includes all of your fields then call the report on click. It is important to mention that you will need to view the query via a form to make this work.
A more detailed version -
The first step will be to make a form based on your query (you will not be able to do this directly from a query). To do this select your query then click on the create tab then click Multiple Items Form. Adjust as needed.
Then create a report that shows ALL of the records how you want it to display. (I will call it rpt_ViewDetails) (we will limit later)
When you are done adjusting click on the field that contains the "abc" etc. results (if this is a calculated field it will be more complicated.) I will call this field "Criteria" for the example. Go to the events tab on the property sheet (in design view). use the On Dbl Click event and go to code builder.
This is what the code would look like (place in between the private sub.... and the end sub lines of code):
DoCmd.OpenReport "frm_ViewDetails", acViewNormal, , "[Criteria] = " & Me.Critera
Let me know if you have any trouble with this, also let me know if the structure is different than I am assuming, I will need a more detailed report of what the query is doing if this is the case, what the structure of the database is etc.

Resources