Hello,
I have the variable UpdateContext({_varseatstaken:0}) and a SharePoint lists with 6 columns which can be true/false.
Now everytime a colum is true it should count +1 and if it´s false it should reset to 0 again for that colum.
If(seat1=true,_varseatstaken+1);If(seat2=true,_varseatstaken+1);If(seat3=true,_varseatstaken+1);If(seat4=true,_varseatstaken+1);If(seat5=true,_varseatstaken+1);If(seat6=true,_varseatstaken+1);Patch('3floor_1',Gallery4.Selected,{taken_x0020_places:_varseatstaken})
I´ve tried a lot and didn´t got any solution. I also tried to do it without a Variable just with the column but didn´t get any results.
Would be happy if someone can help me.
Best Regards
You must use UpdateContext to change the value of the variable, so it will become like this:
If(seat1,UpdateContext({_varseatstaken:_varseatstaken+1})); etc...
Good luck!
First of all thank you for your help.
I have one question left.
I want to Patch the field in SharePoint with this function
Patch('3floor_1',Gallery4.Selected,{taken_x0020_places:_varseatstaken})
So normally it should work isn´t it?
However thank you.
To me it looks like it should work. Only one way to know for sure - try it out 🙂
Unfortunately it´s not working.
It´s not counting the variable correct.
;Refresh('some input') ;If(seat1=true,UpdateContext({_varseatstaken:_varseatstaken+1}));If(seat2=true,UpdateContext({_varseatstaken:_varseatstaken+1}));If(seat3=true,UpdateContext({_varseatstaken:_varseatstaken+1}));If(seat4=true,UpdateContext({_varseatstaken:_varseatstaken+1}));If(seat5=true,UpdateContext({_varseatstaken:_varseatstaken+1}));If(seat6=true,UpdateContext({_varseatstaken:_varseatstaken+1})) ;Patch('3floor_1',Gallery4.Selected,{taken_x0020_places:_varseatstaken})
It´s still not working.
The problem this time is that if seat 1=true your getting 0 taken places and if seat1-seat4 are booked your getting 6 taken places it´s really strange.
Is it possible, because I have a lot of SharePoint columns with yes/no
Put a label somewhere and let its Text-property be
Text(_varseatstaken)
What do you initiliaze the variable to, and when? Check to see when/how the variable changes value.
You could do:-
CountIf(seat1) + CountIf(seat2) + ...etc.
Assuming you only have 6 columns - if you have many more, this wouldn't be the right way to go.
Thanks for your answer.
If I press a button it should set the value on true, which is working correctly because I can see in SharePoint the right values.
When seat1=true the value is 0
When seat2=true the value is 1
When seat3=true the value is 3
When seat4=true the value is 6
Could it be that we need something like Gallery.Selected stuff for the seats?
User | Count |
---|---|
256 | |
106 | |
97 | |
51 | |
39 |