2016년 11월 25일 금요일

Fusion Table & List


Hi! I'm doing an app. And I have a problem when I try to get the value of a FusionTable.
I want to select some values of a list. But if in the value there is no text, it gives an error.

I try doing:
if select list item = 0 
then...
else,,,

But it always give an error.
I attach the screenshot of the code.

Thanks for your help.
List.png 표시 중
-- 
Hello, try this:
-- 
It gives me the same error :

-- 
the fusiontable control got result event will only fire after sending a query to the table...
after sending it once, then there should be a value available in variable LISTA and then you also can use Do it for debugging...

Taifun

-- 
Yes, but the matter is that the fusiontable don't return a value because there's no enough values of Index.
Index 1 works because there's one value, but the second doesn't work because there is no a value in the fusiontable. 
So what I want to do is if the fusiontable don't return a value set a message like: Error.
But I can't set 
if the list is empty
then set Label... to Error
Else set Label to Select Item (list/index)

-- 

the fusiontable don't return a value because there's no enough values of Index.
??? 
the fusiontable always will return something
a) a result as csv table
b) an error message

how does the query look like?
It would really help if you provided a screenshot of your relevant blocks incl. Do it result of the SQL query, so we can see what you are trying to do, and where the problem may be.
see also 


Taifun

-- 
It returns an error: Select list item: Attempt to get item number 9 of a list of length 7: .
I provided the screenshots: 
The Screenshot  :  
Is the result of the fusiontable without doing a select item.

Thanks for your help :)

List3.png 표시 중

List4.png 표시 중
List5.png 표시 중



List6.png 표시 중

S61125-222240_Ink_LI.jpg 표시 중
-- 
to select the 9th item of a list, which only has 7 items does not make much sense, does it?

from the fusiontable control got result event in your case you receive a 1 column csv table (because you selected only 1 column)
to simplify a little bit, convert that table into a list use the split block, just split at \n (new line), (see arrow screenshot 1)
and remove the first item (which is the header row)
then before selecting the 9th item of a list make sure, that this is a list, which has min. 9 items (see arrow screenshot 2)...

if length of list (LISTA) < 9
then error
else display the 9th item


also it seems to be, you are not familiar with Do it?

see tip 4 here 

Top 5 Tips: How to learn App Inventor 

and again


Taifun

-- 
That works!! Thank you !!

-- 

equals


Hello,
whats the diferent between the blue and the green equal block?

No matter what color block i choose?

Best regards

-- 
as far as I know there is no difference
Taifun

-- 
There is a significant difference in the two blocks.  The blue equals is used ONLY with mathematical relationships.  The green equals can deal with symbolic and text relationships .

These are the logic blocks     described in detail here http://appinventor.mit.edu/explore/ai2/support/blocks/logic.html    The green = sign works like this:

    Tests whether its arguments are equal.
    • Two numbers are equal if they are numerically equal, for example, 1 is equal to 1.0.
    • Two text blocks are equal if they have the same characters in the same order, with the same case. For example, banana is not equal to Banana.
    • Numbers and text are equal if the number is numerically equal to a number that would be printed with that text. For example, 12.0 is equal to the result of joining the first character of 1A to the last character of Teafor2.
    • Two lists are equal if they have the same number of elements and the corresponding elements are equal.
    Acts exactly the same as the = block found in Math

These are the Math blocks.   They are the blue blocks.  All the Math blocks are described here  http://appinventor.mit.edu/explore/ai2/support/blocks/math.html  

The blue Math block works like this:
Tests whether two numbers are equal and returns true or false.

Where   variable1 and variable2 are numbers,    if variable 1 = variable 2 then ....

Regards,
Steve

-- 
thank you @SteveJG
however the blue = block can also work with alphanumeric values...


Taifun

-- 

Trying to UPDATE Metadata with PUT api got a strage error


Dear Colleagues:

I am working in an app to upload photographs to Google DRIVE.

I was able to UPLOAD, but as you know file got no name, so I intent to PUT the "title" in the metadata.

After a whole day of trying with no success I got the message in the enclosed image.

I am using version 2 of the DRIVER apis, as version 3 updates with a PATCh directive not available in the inventor.

Can you please give some advice in order to overcome this issue.

I look forward for your comments and help on this matter.

Regards 

Put Problem.png 표시 중

-- 
From the message and your blocks, it looks like you are missing the /upload/ level before the /drive/ in your URL?
ABG

-- 
to update the metadata of an already uploaded file, you have to use Content-Type application/json, see also the API documentation

example
 example.png



Taifun

-- 
I used /upload/ when I upload for the actual file. It worked fine but the file appears with no name. That is why I sent the second request with out the parameter as the API documents states.

Thanks for your interest Abraham

-- 
I will do as you suggest. Thanks. I have been using your valuable web page both a a source of information as guidenline. Thanls again. I will keep you posted on the results.

-- 
Dear Taifun:

It finally worked¡¡¡¡¡

Thanks again for your suggestion and interest. You are the man.

In the app I am building I am using Fusion Tables as well. This will be in the end a kind of Mashup as the one mention in you documents.

Sincerely

Daniel Suzuki

-- 

Problem with sliding over buttons.


Hey there, I built a LED-Matrix (10x6 ws2812b leds) and connected it with bluetooth to my arduino. Now I placed buttons like the Matrix. When I press the first button the first led going to blink for a half second..when I press the second button the second led ist going to blink for a half second and so on. 

Now I want that the leds going to blink when I slide over the screen. But when I for example slide over the first button to the second, the second button dont work because I did not lift up my finger from my screen. The first button is still active till i lift up my finger from the screen. Is there other ways to do it? I need something that deactivate a button when my finger is not longer touching it but without to lift up my finger only to slide the finger away from it. SORRY FOR MY VERY BAD ENGLISH.

--
try the canvas and use image sprites as buttons instead
Taifun

-- 

How can I do? (URGENT)


Guys, I'd like some help from you guys.

How can I create an app in the app inventor 2, take a photo and then search for this image on google?-- 
-- 

the Google Image Search API is deprecated and I don't know how you can do it using the Custom Search API, see also http://stackoverflow.com/questions/34780131/using-google-custom-search-api-to-find-images

http://googlecustomsearch.blogspot.com/2012/02/image-results-now-available-from-custom.html

this is a nice challenge... let us know what you find out...
good luck!

Taifun

-- 

In-app Billing for Play Store


I am using Taifun's in-app billing extension. I have some questions related it:

For example, I would like to remove ads after purchase. Should I publish 2 apps to Alpha (with ads and without ads) OR publish 1 app and code this: "After purchase, remove all ads (permanently, e.g. TinyDB)"?

Also see attachment for 2 more questions.

It would be nice to see publishing process step by step on forum or video.

--
see my answers in Q4 - Q6 here https://puravidaapps.com/billing.php#q

-- 
To make some procedures after purchase [e.g. "If the payment is successful (or not?), AdCanvas visible false ....."], I couldn't combine right blocks. What should be matched with "successful"?
-- 
it would help to examine the prepared example carefully...


there you could have found out, that you have to call the LoadOwnItems method to receive the available (i.e. bought) items in the GotOwnItems event
there you get 2 lists back, a list of own products and a list of own subscriptions...

probably it also helps to understand the difference between product and subscription?
see also https://developer.android.com/google/play/billing/api.html

if you like to offer some additional features in your app after paying a fee, probably a one time payment would be sufficient to upgrade to the paid version? Use a product in this case (and not subscription). Subscriptions are for recurring payments (e.g. monthly).

-- 
Sorry, I've read all of them but this is a bit difficult to understand for me. 

I don't have list of products, there is only 1 "product" to buy to upgrade app PRO version. (simply just for removing photo watermarks and ads, both together in 1 purchase)

I've tried to create blocks but I am pretty sure it's wrong. 


let me prepare another example - as simple as possible - 
I will publish it on my webpage and send it to you privately tomorrow

meanwhile you might want to learn how to work with lists

• How to work with Lists by Saj
• How to work with Lists and Lists of lists (pdf) by appinventor.org

--