Limited variables and maths between them

I need users to input between 2 numbers lets say 86 and 90 in 2 text components. User input a value of 0.05 in 3rd text component where 0.05 is a recurring addition to 86 number (1st value) until 90 and breaks out of the loop.
So it starts with 86 then 86.05, 86.10, 86.15, 86.20 … 89.95, 90.00 and breaks out of loop.
Similarly in reverse direction 90.00, 89.95, 89.90, … 86.05, 86.00 and breaks out of loop.
App should be able to store and display 86.05,90.00 in 1st label; 86.10, 89.95 in the second label; 86.15, 89.90 in the third label. These label should be created by app itself.

Basically I wanted to add, subtract, multiply, divide using a constant number 0.05 between 86 and 90 and display 1st 4 outputs of each function into 1 label.

I used list viewer with stored variables, forever function and break loop but could not get anything. Can anyone help on these blocks. Thank you so much in advance.

1 Like

You have posted your question in the ClassicArchive category but it should be in the Thunkable Discuss category. I shifted it to the correct one.

As for the reply to your question. Please share what have tou tried so far so that others can suggest/correct the codes.

[Edit]

Is this what you are looking for?

Following are the blocks
image

2 Likes

Amazing. This is what I wanted. If I have 4 results then I would store in 4 labels (all 4 labels designed manually); how would the app create labels depending on more results.

Lets say I have 100 results- what kind of code to be written so that app creates it own labels for all 100 results.

2 Likes

In the Any Components drawer there are clone block and create block which you can use to create new labels when needed.

1 Like

I have 2 text components where user can enter. “From” and “to” text components. But when I connect to “initialize app variable 86to90- List of numbers from and by” it shows an exclamation mark

Instead of selecting 86 and 90 by default, I want the user to type “from” and “to” by themself.

1 Like

The initialize block cannot take user inputs. If you want the list to be controlled by the user then you have to create the list by the code blocks with initialize block.

2 Likes

Check this project.
I made it to show the way you can implement your idea as I understood it.

https://x.thunkable.com/projectPage/613cf6b5bbd2d40011fc7184

2 Likes

I am very grateful to you. Thank you very much

2 Likes

I used create block in loop and able to create them as many as possible. But how do I name them automatically at the same time?

I would prefer to give them names 86+90 1st label, 86.5-89.5 2nd label, and so on… as per the results

1 Like

Also, I have
Listviewer1------------------Listviewer2------------------------------Listviewer3
89------------------------------82, 6.68, 8.89, A
88------------------------------87, 6.78, 7.79, BA
87------------------------------86, 5.48, 1.19, BGA
86------------------------------85, 5.22, 5.69, AD
---------------------------------88, 16.68, 18.89, AB
---------------------------------95, 5.68, 28.89, A
---------------------------------115, 25.68, 8.89, A
---------------------------------89, 5.68, 28.89, A

I did descending order for listviewer1 which you can see as above, I am trying to match 1st number is listviewer1 to listviewer2 and display the full content in listviewer3 respectively.

Example, results shall display as below:
86 from listviewer1 should search and display 86, 5.48, 1.19, BGA from listviewer2 at 1st place in listviewer3.
87 from listviewer1 should search and display 86, 5.48, 1.19, BGA from listviewer2 at 1st place in listviewer3.
88 from listviewer1 should search and display 88, 16.68, 18.89, AB from listviewer2 at 3rd place in listviewer3.
89 from listviewer1 should search and display 89, 5.68, 28.89, A from listviewer2 at 4th place in listviewer3.
(Similar to Vlookup in excel)

Thank you in advance

2 Likes

Please show what you have tried and mention where you get stuck. The table and explanantion you gave is not clear, at least to me.

2 Likes

I managed to get find solution for this. Thank you

In your project divide by 0.5 works very well but divided by 0.1 have issues.
If “from is 86” and “to is 87” then results are as below:
86
86.1
86.19999999999999
86.29999999999998
86.29999999999997
and so on to
86.99999999999994

But I am looking for exact 2 numbers after decimal

I tried decimal places block but did not work.

Use this block:

1 Like

As I stated, decimal block is not working for variables

I’m so sorry, I didn’t see that comment earlier.

Please post a screenshot of the blocks that are not working.

1 Like

The above pic is from the project provided by Mr.Muneer on 12th Sep in this post. You will see the whole project. I just changed 0.5 to 0.1 in “LIST BY” block

And where did you attach the “with 2 decimal places” blocks? I see them but am not sure where you actually placed them to test the code.

2 Likes

I sent you the pic of exact project which Mr.Muneer shared with me except I replaced 0.5 with 0.1 in build my list function.
While doing this I tried using the block (decimal places) which you suggested and because it was not possible I removed the decimal places block out and put it aside which is visible in the pic beside build my list function just to show you that I followed your suggestion.
I will send you the pic in few min to show you the exact project in case the above sent pic is not clear.

1 Like