I have a gallery which Ive created a variable from a ThisItem
Set(varQuantity, ThisItem.Quantity)
Then I have called the variable in a textlabel
varQuantity
I am trying to edit varQuantity on + and - buttons
UpdateContext({varQuantity: varQuantity-1})
UpdateContext({varQuantity: varQuantity+1})
for some reason its not working and its setting a new variable and wont recognise the one I have set and am trying to call
Could someone help me, is UpdateContext the wrong thing to use?
Kind regards
Ryan
Solved! Go to Solution.
I would expect a field called quantity to be a number already.
You can check what type it is and optionally convert to a number by using the Value function.
Also, if the field can be empty, you should add some logic to handle that situation.
Set is used for global variables, UpdateContext for local variables.
If you use Set again, it should work as expected.
hi @shoog ,
Thank you , Now I am getting this error
Do I need to define it as a number when its set, and then call it as a number>
If so, How do I do that?
Kind regards
Ryan
I would expect a field called quantity to be a number already.
You can check what type it is and optionally convert to a number by using the Value function.
Also, if the field can be empty, you should add some logic to handle that situation.
thank you thats enabled it to work, youre right my SP list quantity wasnt set to number...
Works now locally but doesnt send the data back to the SP list now
How would I do this?
Kind regards
Ryan
In the update property of the datacard (or in your patch function if you use that), you will have to convert the number back to the original datatype.
User | Count |
---|---|
261 | |
128 | |
99 | |
48 | |
47 |