I want to when i press a button "Add" (Lägg till) it will add the value in the box to the left (7) to a value which will then be presented in the text input on the top (Summa [TEXT INPUT] kr). How do i do this? I will add more products to the list which will then also be added in the same way. But what code on the button do i need to put in?
Also I will need a button to reset the value. Is this possible?
Solved! Go to Solution.
You can use a variable that represents the default value of that text input, which you can initialize to 0 (such as on the screen's OnVisible property) - and you can also use a button to set that value back to zero, resetting the value.
Screen.OnVisible: UpdateContext({ value: 0 }) SummaTextInput.Default: value ResetButton.OnSelect: UpdateContext({ value: 0 })
On the list of items, I'm assuming you have them in a gallery. If the value (in krona) is represented by the column 'Value', then you can have this formula in the Lägg till button:
LaggTillButton.OnSelect: UpdateContext({ value: value + ThisItem.Value })
That will update the 'value' variable, and its value will be reflected on the text input.
You can use a variable that represents the default value of that text input, which you can initialize to 0 (such as on the screen's OnVisible property) - and you can also use a button to set that value back to zero, resetting the value.
Screen.OnVisible: UpdateContext({ value: 0 }) SummaTextInput.Default: value ResetButton.OnSelect: UpdateContext({ value: 0 })
On the list of items, I'm assuming you have them in a gallery. If the value (in krona) is represented by the column 'Value', then you can have this formula in the Lägg till button:
LaggTillButton.OnSelect: UpdateContext({ value: value + ThisItem.Value })
That will update the 'value' variable, and its value will be reflected on the text input.
User | Count |
---|---|
140 | |
133 | |
79 | |
75 | |
74 |
User | Count |
---|---|
210 | |
200 | |
71 | |
66 | |
55 |