Hi, I created a Label and named it as 'Price : 30 Rs' .In a block editor, how can I extract only the number and do any math like userinput*30?

Hi, let us assume a t shirt is 30 rs,

I created a label named Price : 30 Rs. And, I want to to multiply the number 30 with the quantity I get from user in ‘text box’. So, how can we extract the variable 30 from the label to do further calculation in block editor?

Don't rely on label values for calculations. Use a variable to store your price and display this in your label. Then use the maths blocks to carry out your calculation using the variable.

1 Like

You can also pull in a Horizontal Arrangement with extra Labels surrounding the Label with the number, to keep the numbers and text separate.

30 is variable, il update the price every day in label, so blocks have to automatically extract the price value for calculation.

In this method, how ‘get.global price’ will get 30 from the label text ‘ Price : 30 Rs’?

Re-read what i said above.

Set the price (30) to a variable. Display this with the joined text in your label.
Use the price variable to do the calculation.

1 Like

will the app inventor accept the text box data as number if users enter number? for further background calculation like multiplication and addition? Because, im facing some error.

It should, but if you want to err on the side of caution, multiply it by 1

image

Error msg: —— Error 601: No Corresponding activity was found.

The whatsapp no. in the screenshot is not real, but while testing i used real no.

This top part looks wrong

but need to check what you are shown in the video

Yes, datauri needs to start with the url:

image

You ask for the screenshot to be shared towards the end of your join, so no need to ask again.

1 Like

Thankyou for your help, your guidance helped me to go one step ahead and find another issue. ie, I got error even after doing this change,

but fortunately the solution was in the video. In the video he is saying to put all the texts within the =>, so i added => in a new text block and put it after the block contains Thankyou. Now, it is opening the whatsapp but with another issue.

The new issue is that ‘the app has to open owner whatsapp number automatically with the message to send to the owner number. But instead of opening the exact whatsapp number, it is just opening the WhatsApp and showing all contact numbers to send to anyone i choose. It is not directly opening the shop owner’s whatsapp number. How can I solve this error?

Is your phone number in international format, e,g, begins with 44 for UK, 91 for India ?
Have you url-encoded your text (there is a block in the web component for that)?

I did not see anywhere in the video where he told you to use <= or => to surround the text ?

Can you send a whatsapp message to the whatsapp number of the device running the app ? ( I presume you are testing on your own phone, which will have the same phone number as the number you are sending to ?) - from what I see in the video it appears that you can, but it might be useful to use a different number not on your phone.

Simplify what you are trying to send, for testing purposes

1 Like

Okay, I tried using different whatsapp number with +91 prefix, still the same issue.

And, about using =>, yes this is my misunderstanding.

It worked now, there was a symbol < before whatsapp number. Now it is working after removing that symbol. Thankyou :slight_smile:

I tested too, and it worked fine, selecting the user from the number and setting up the message.

1 Like

Is it possible to calculate multiple product purchase data? Now, the app can calculate single product purchase, is it possible to make the app to calculate the values if user wants to purchase multiple products?

Yes I am sure you can. You will need to figure that out in your blocks.

1 Like