Numbers from Web Component

Hello
I’m creating an app that download number from my PC in local network using Web Component.
My problem is the number that it download. For some reason I can’t use that numbers in math components because Kodular don’t recognize them as numbers.
prob

Is there any way around this problem, it’s a bug, or I’m doing something wrong?

Hi @Truzaku, welcome to the community!
It will be great if you provided exactly the response content provided by the website :slightly_smiling_face:
For example 1,2,3 won’t work with the math blocks

Sure,
here’s what i’m trying to do
"1
and response
2

Set a variable you’ve initialized to number to the response content.And then, add the add operation + to the variable.

2 Likes

OK, but I don’t understand how to do this :pensive:. Is there some block for that?
Could you please explain it step by step?

bild

Replace comma with dot

2 Likes

Your solution does not work for me.
Probably because you misunderstand my problem
My input from get response content block is already and just 19 so there is no comma to replace.
3
But I can’t explain that comma from Runtime Error

please provide the complete Do it result fo Label25 as it is… you are showing only a comment…
probably there is an invisible new line character \n inside the response content?
try the trim block to remove it

Taifun

1 Like

Do it result


There is no \n or new line and trim not change anything

I tried to set textbox text to response and then copy it to another textbox to check if it it is a number:


The result is false. I also used length block and result is 3 instead of 2.
So there is some invisible character that I can’t select or delete and it’s not a newline.

Try:
replace all text
segment “” 1 space
replacement “” no space

May I ask how you are able to use doit on local variable

bild

1 Like

yes… I also would be interested in this…

to remove a character see the snippet in Q4 here App Inventor Tutorials and Examples: Dynamic Table Layout | Pura Vida Apps

Taifun

1 Like

And SOLVED!!! Thank you! :grin:
I used App Inventor Tutorials and Examples: Dynamic Table Layout | Pura Vida Apps from Taifun but invisible character was first, not last so I used reverse block 2 times like this :


and now result is 19 and it’s recognized as number in math block.

.

Well about that when I clicked Do it this showed up: 6
so I just typed 19 :sweat:

Did you find out why Response Content has this invisible character ?

Did you find out why Response Content has this invisible character? Does anyone know why this happened?

I have no idea.
You can’t select it in the textbox, but you can copy and paste it using select all, but when you do, it’s still there when you try to use is number block that respond with false.
When I used do it 6 and typed 19, the character was added and is number block responded with false.
So problem definitely isn’t with downloaded text in response Content but something in Kodular

1 Like

Is this return from your api?

I’m sorry but I don’t understand your question. :face_with_raised_eyebrow:

You are using web Component, right? And the return (Response Content) comes from an API, or not?

The return comes from file on website that I host on my PC using local network. The file that web component use contain only that number.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.