Fusion Table query in App Inventor does not work - google-fusion-tables

I have the following code blocks in App Inventor:
Note: The red warning is because I have a second btnRemove.Click event which is a disabled block and is not used.
This is my Fusion Table:
Right now I am trying to remove the row that has ID number 15 when the button click event is called. If I click the button I see the fusion table window (rotating for a second) and then dissapears. This indicates that something is happening but not what I want it to happen.

This does not work, because the DELETE statement needs a ROWID to be able to do the delete, see also the SQL Reference Documentation of the Fusion Tables API.
DELETE FROM <table_id>{ WHERE ROWID = <row_id>}
which means, for DELETE statements the first step to be done is to get the ROWID of the row to be deleted with a SELECT statement. The second step is to do the DELETE.
Also I would use the FusiontablesControl.GotResult event to get the result of the query back, in your case the error message...

Related

How can I insert a button in a form connected to a parametric query in ms access with auto-fill

My problem is that I have:
a parametric query that finds me the games played specifically by a player through an id;
a form through which I scroll through all the players in my database.
My goal is to insert a button in the form to auto-fill my query, using the data present at that moment on the form, and then return the results to me.
Anyone have any idea how to make it work?
-I am currently working on Access (Version 2112 Build 16.0.14729.20254).
First add to the parameter query under the ID column view, criteria area, the a criteria that is similar to the one below
[Forms]![book]![bookid]
Where book is name of the form, you want to place the command button on
and bookid is name of the control on the form that has the ID field
Next you save the parameter query/select query
Finally you create a command button that will run the query.
Once you click the command button, it will display records in a query where the ID is the current records ID.
I have attached some images that explain the steps.

How can I post updates for deleted records using TEMSDataSetResource in RAD Server 11

I have created a simple new Rad Server Package with resource with a data module to access a Firebird 3.05 database running on Ubuntu 18.0.4. I included sample endpoints and a database endpoint with one table from the database.
I modified the created FDQuery to return a subset of the records.
select * from EXPENSES where COMPANYID = :COMPANYID
It indicated the FireDACFBDriver was not found, and instead of adding the PhysFBDriverLink, I deleted the FireDACFBDriver in the project source and it asked to add back the FireDACIBDriver and it works. This is besides the point, I think, but just full disclosure. I have tried the PhysFBLink with same results, but have had trouble switching back and forth to Linux deploy, so this works for testing I believe.
The client app consists of a TEMSFireDACClient, a FDSchemaAdapter, FD TAble Adapter, FDMemTable and datasource and dbgrid and three buttons.
Button1
Expenses.GetEndpoint.Params.Clear()
expenses.GetEndpoint.Params.AddItem(
'CompanyID','10000080');
Expenses.GetData();
Button2
FDMemTable1.delete;
Button3
Expenses.GetEndpoint.Params.Clear();
expenses.GetEndpoint.Params.AddItem(
'CompanyID','10000080');
Expenses.PostUpdates;
Button One retrieves multiple rows, and button two deletes a row locally, and button 3 tries to apply the table updates back to the server.
When attempting to post updates. I get the following error:
EMS Error: Resource error. Request parameter not found: COMPANYID.
This works when the resource SQL is SELECT * FROM EXPENSES. Is it just that the TEMSDataSetResources can only work on the full table, or Is there something simple I am missing or a reference available for how to accomplish this?
I have tried creating a manual delete endpoint with:
delete from EXPENSES where EXPENSEID = #####
However, that is another post maybe if I have to go there. I cannot get around and error converting Unicode to integer variant when passing the parameter.

Delphi FireDAC: how to refresh data in cache

i need to refresh data in a TFDQuery which is in cached updates.
to simplify my problem, let's suppose my MsACCESS database is composed of 2 tables that i have to join.
LABTEST(id_test, dat_test, id_client, sample_typ)
SAMPLEType(id, SampleName)
in the Delphi application, i am using TFDConnection and 1 TFDQuery (in cached updates) in which i join the 2 tables which script is:
"SELECT T.id_test, T.dat_test, T.id_client, T.sample_typ, S.SampleName
FROM LABTEST T
left JOIN SAMPLEType S ON T.sample_typ = S.id"
in my application, i also use a DBGrid to show the result of the query.
and a button to edit the field "sample_typ", like this:
qr.Edit;
qr.FieldByName('sample_typ').AsString:=ce2.text;
qr.Post;
the edition of the 'sample_typ' field works fine but the corresponding 'sampleName' field is not changing (in the grid) after an update.
in fact it is not refreshed !
the problem is here: if i do refresh of the query, an exception is raised: "cannot refresh dataset. cached updates must be commited or canceled
and batch mode terminated before refreshing"
if i commit the updates, data will be sent to database and i don't want that, i need to keep the data in cache till the end of the operation.
also if i get out of the cache, data will be refreshed in the grid but will be sent to the database after qr.post and i don't want that.
i need to refresh data in the cache. what is the solution ?
Thanks in advance.
The issue comes down to the fact that you haven't told your UI that there is any dependency on the two fields - it clearly can't know how to do the join itself without resubmitting it so if you don't want to send the updates and reload you will have a problem.
It's not clear exactly what you are trying to do, but these two ideas may help you.
If you are not going to edit the fields in the SAMPLEType tables (S) then load the values from that table into a lookup table. You can load this into a TFDMemTable. You can use an adapter which loads from a query. Your UI controls can then show the value based on the valus looked up in your local TFDMemTable. Dependiong on the UI control this might be a 'LookupField' or some such.
You may also be able to store your main data in a TFDMemTable with an Adapter - you can specify diferent TFDCommands to read the whole recordset, refresh a record, update, insert and delete a record. The TFDCommands can act on multiple tables for joined recordsets like this. That would automatically refresh the individual record for you when you post it.

Keep all row checkboxes & header row checkbox selected or checked by default in Angular-Slickgrid

I am using Angular SLickgrid and want to show all the checkboxes for all rows & also header row checkbox as selected by default (when grid loads). I am able to achieve it partly by using this.angularGrid.gridService.setSelectedRows(this.allDataId)
but I am getting errors in console and all data rows are not visible. I cannot use preset because I want to show all rows selected & till the time angular grid is loaded, I don't have all row IDs. Below is the error that I am getting. I have added null checks before passing data to setSelectedRows() but no use.
TypeError: Cannot read property 'children' of null
at ensureCellNodesInRowsCache (dist/data.bundle.js.gz:2692)
at getCellNode (dist/data.bundle.js.gz:2692)
at updateCellCssStylesOnRenderedRows (dist/data.bundle.js.gz:2692)
at setCellCssStyles (/dist/data.bundle.js.gz:2692)
at Event.handleSelectedRangesChanged (/dist/data.bundle.js.gz:2692)
at Event.notify (/dist/data.bundle.js.gz:2674)
at RowSelectionModel.p [as setSelectedRanges] (/dist/data.bundle.js.gz:2692)
at SlickGrid.setSelectedRows (/dist/data.bundle.js.gz:2692)
at SlickGrid.m (/dist/data.bundle.js.gz:2692)
at Event.notify (/dist/data.bundle.js.gz:2674)
Please suggest how to achieve it. Thanks.
The answer, if that is an acceptable one, is in your question. The SlickGrid Row Selection plugin is not meant to be all selected at first so you have to stick with using setSelectedRows and if you don't have all Ids at hand then call it when you do... and in case you're pushing data in chunk, then call setSelectedRows on each chunk. There's no magic here, you need to call it when you have the correct Ids

How to disable caching of select2 search results?

I have two select2 containers, which work together side-by-side. Both are ajax based selects, and the selected value of one of them, determines the results in the other.
My problem is the following: when I select the first of the two select boxes, and open up the second one, it is prepopulated with the correct search results. Yet, when I change the first select, and then reopen the second one, for a split-second, while the ajax request is sent for the new data from the second select option, the results that were shown previously are still visible and selectable.
For a concrete example, imagine the following two select boxes: one is for occupation, and the other contains names of persons. The intended use case would be, is to select an occupation in the first one, and then the second one will only list the persons with that occupation. If I select, for example doctor as the occupation, and then list the second one with all the doctors I get the correct result. But if I then reselect the first one, and change it to engineer, and re-open the second one, I will get the list of doctors for a split-second, before the ajax manages the load my engineers. I can even select a doctor, as an engineer, if I am quick enough.
Is there a way to disable this behaviour? IE: whenever I click on an ajax related select2, show me an empty list, or the "Searching" string, while the request to the server is made, and an answer is returned?
Select2 "caches" options retrieved by ajax inside the options of the original tag. To disable cache as you say, remove all those options just before the new option gets selected.
In practice, removing options before or after does not make a difference in your problem, but if you were to have this same problem in a single select (not combining two as you mention), you should do this with the event 'select2:selecting', instead of 'select2:select' event (Select2 events)
$('#select-occupation').select2({
...,
ajax: {
...
}
})
.on('select2:selecting', function(event){
console.log('actual value: ' + $(event.target).val());
$('#select-people').find('option').remove();
});

Resources