How to sum numers from a list?

image

Hi guys, my question is simple but my problem is still big for me !!
I will explain exactly what I need now
In the first column, I need to sum all of them and show in the last label … (all column’s need this, but if i learn how to in one, will can do in others i think)

You mean something like this:

image

?

(Of course, here, “mylist” can be a sub-list, or a column of your table, depending how you encoded it)

1 Like

Sorry i dont understand…

I will give a example…

If i write 500 in #1, 4000 in #2 and 9000 #3 the last label will return 13500…

(the #1-#9 is just hint"s)

like this screen

is only sums…

image

The answer depends on how your list is organized.

Is this a list or a spreadsheet?

In your example, 500 is referred as what? Element 1 of a list of 9 that includes (500,1500,5000 … and 3 “undefined”) ?

The problem is not how to do thing, the problem is determining how things are saved now, THAT decides how to go about processing it.

So what do you have? What am I looking at? A bunch of 36 separate entities? 4 lists (column) of 9 elements each? One list of 4 lists of 9 elements?
Are you expecting to leave those #7, #8 place holders there, or would an empty field be left blank?
What about the 4th column?

1 Like

Column 1 and 2 are text_imput because we need put the numbers… column 3 and 4 are labels because this columns just return us the results…

Are you expecting to leave those #7, #8 place holders there, or would an empty field be left blank?
What about the 4th column?"

Its impossible to know, because you just will know in the moment are using the app… So if have 3 people, will use only 3… if have 9, will use 9…

Its better use list? please give me ideas to do this…
So dont remember, column 1 and 2 we need put the numbers and columns 3 and 4 no… :wink:

Thanks.

Well then, they are not arranged in a list, so cannot be indexed.
I am afraid you will have to get a long equation that calls each text_input by name, the system does not have any way knowing you want to add those.

In classic, you could have made a list that refers to each of those text_input, and you could then use the content of each of those components in a loop that would access them each in sequence, but that is one of the feature they apparently have not yet deployed in X. Classic also has those text entry event that could behave like a button click, so could push the data into a list using an index specific to each text field.

If your values were in a list, that would have meant that the individual text_entry were already explicitly associated to a specific element of the list somewhere else in your code.

There isn’t much you can do with the current components that would not imply quite a bit of code.
One approach would be to replace all your text entry with a button that is showing on TOP (or in the same place) as the text entry. When you click in a button to enter data in it, the logic takes a note of which button is currently having the focus, cause the button to become invisible while makes the text entre become visible. When the entry is done, then someone evidently has to click somewhere else, so the logic would know to take the text entry value, push that in a list at the index location, use that value again as a caption to the button (so the value is visible). You still have an issue when the very last entry is in since there is no other button left to click, unless you make one to call for getting the total.

As I said, not matter how you look at it, it is not straightforward with the current version of X…

No problem create a buttom “calculate” to give the results…

So, i need change the 9 text imput from column 1 and 2 to list? :thinking:

Its better classic thunkable? because not are a problem to change…

Yes, it would be a lot simpler in classic.
The down side is that classic does not support iOS; only Android.

But you cannot really display the data from a list, you still need a displayable component that is associated with the list element. That is where the problem is: you would need a list for easy data processing AND a unique component for each display. In classic thunkable, the association between those is much simplified thanks to the “any component” feature.

i can imagine… but i need support iOS =(

hope one day i can do this =P

1 Like

Hi there,

You can add three numbers together by nesting two + blocks, so that you have
((number1 + number 2) + number 3)

can you show me how?
i will need add 9 numbers, its possible?

thanks

Something like this:

where the respective 1, 2 3 and so on are replaced by whatever it is you need to add.
HOWEVER there is an important aspect in that whatever value you DO NOT HAVE need to be set to zero or be seen by the program as being zero.
You probably will need to test it to ensure empty fields are indeed empty (as opposed to be populated by those #8 “hints” if they are more than just hints to the program)

1 Like

Yes my friend YES!

I change all hints #x for text = 0… so its fine now =D

Thanks!!!

2 Likes

its possible have the #1 - #9 hints and the program see this is 0?

When i put the numbers, i have the result in the column 3, but the numbers appers 113.63636363… Its possible show only 113.63 or 113.64? just 2 “houses” max?

1 Like

How do you end up with more decimals than you started with using only additions? You have a multiplication or division in there as well?

Anyway, this function will round any value to the number of decimals you want. If you put a negative value for places, like -1, it will round to the nearest 10. Putting places=2 will give you 2 decimals.

I invite you to read other people questions, since this exact function was provided 3 days ago for someone else. Reading would have saved you asking the exact same thing.

2 Likes

I try read forever before i create another topic, but sometimes i dont know the key words to search… =(
Sorry CBVG, but thanks for help me =)

Yes, the column 3 use multiplication and divison to return the exact answer i need.
See here…

I try read forever before i create another topic, but sometimes i dont know the key words to search… =(
Sorry CBVG, but thanks for help me =)

Yes, the column 3 use multiplication and divison to return the exact answer i need.
See here…

i cant acess this account (db8220…) so i will use this new…

Hi, @Yukold! :wave:
Try to use this block : (it only works with a list.)
very%20temp

Thanks :wink: