It might be informative for you to right-click-DoIt on the
JOIN and the GET GLOBAL ROWID block in it.4
--
I see now.
You shouldn't call your aggiorno procedure until the rowid has arrived.
Move the call to the GotResult block where the global receives its value.
--
as ABG said, and if you check the result from the fusiontable, you will realize, that you will get a result like this
rowid
103
which means, you first have to extract the rowid (in the example 103) and then continue with the update statement
to extract the rowid, just use the split block and split at \n (new line) to get a 2 items list, then select the 2nd item, which is the rowid
--
Ok, error is only this. When I find ROWID, the variable contains "rowid xxxx". How can I delete the first part and use only the number?
--
Use the segment block from the text drawer. You know it'll say rowid and a space, then the number, so start your segment at 7 and go to the end (length of the string - 7).
--
Taifun's idea is more robust.
It protects you against counting errors
and from having to figure the length of the rowid string.
--
you might want to READ again my previous answer in this thread...
--
@Enis: it is something like this rowid\n103 ...
--
Have I to set \n in the variable settings?
--
On second thought, I did not factor in
the '\n' learning curve in my robustness estimate.
...Waiting to see how this pans out.
--
Ok, It works at 99%. Finally i have the ROWID in the "global rowid". When have I to call update procedure?
--
see screenshot
and: I would use a global variable to indicate, what kind of action you are executing
before selecting the rowid, set that variable to "select" and before doing the update set that variable to "update"
then you can check in the FusiontablesControl.GotResult event, which action you are executing (if-then-else statement)...
if action = select
then get the rowid and call the update procedure
else do something else
--
I tried yet and now. It doesn't work. Now I'm trying to generate apk.
--
I just have seen, you are using a second fusiontable controls component, which means, you do not need my action variable...
check your update statement...
this probably can help
--
Now I try with one FusionTablesControl. The 2nd was only an experiment.
I HOPE IT WORKS!!
--
It doesn't work and the app runs in an infinite loop...
I hope You can see what's the problem.
--
If you are asking for help, I recommend you to make it as easy for others to be able to help you ...
which means in your case post a screenshot of your relevant blocks...
You probably will get more feedback then...
To download the aia file, upload it to App Inventor, open it, do some bug hunting for you, etc... this takes time, and most people will not do that...
--
--
oh yeah...unfortunately you did not follow any recommendations...I only can recommend you to restart from the beginning...
For UPDATE statements the first step to be done is to get the ROWID of the row to be updated with a SELECT statement. The second step is to do the UPDATE.
see also How to INSERT, DELETE and SELECT a Fusiontable by Viktor
--
There's no reason to restrict yourself to just one Fusion Tables (FT) control, right?
Imagine you had a factory assembly line with dumb workers that only knew
how to do one small task before passing the work onto the next worker.
If you had a FT control named FT_UPDATE_Part1 that only got the ROWID,
you could have its results received block set up the UPDATE statement for
use by the next worker (FT control), FT_UPDATE_Part2.
That simplifies the code and the process flow.
--
댓글 없음:
댓글 쓰기