Hello,
I am trying to create a button to filter a Gallery by Status.
On Visible - 3 Status should only be visible ;
Not Started
Deferred
In Progress
I want to be able to press a button and only the Completed ones appear.
I am following the instructions provided on this link ;
I cannot seem to get it working. Would appreciate any insight .
The Gallery Item is set to 'Work Tasks'
The Status Column is Choices('Task Status')
Following the instructions on the link this is what I did ;
1 - Set the OnVisible property of the screen to:
Set(Thevar,"Not Started,Deferred,In Progress")
2 - Add a gallery control and set its Items property to:
Filter(Work Tasks,Text(Completed)=Thevar)
3 - Add a button control and set its OnSelect property to:
Set(Thevar2,!Thevar2);If(Thevar2=true,Set(Thevar,"Completed"),Set(Thevar,"Not Started,Deferred,In Progress"))
I am getting X errors on 2 and 3. What am I doing wrong? I would appreciate any help . Thank you in advance!
Hi @IchigoKun,
You're almost on the right track. Filter expressions on Dataverse tables you'll need to reference the values instead of text. Try the following things:
1) I don't think you need the "Thevar" variable, you can filter directly the desired on the button click
2) Items property to. Where Completed is the name of the status field. Itellisense should kick in to pick the desired status items
Filter(Work Tasks, Completed = Completed.'Not Started' || Completed = Completed.Deferred || Completed = Completed.'In Progress')​
3) OnSelect of the button, set the Items property of your gallery. For ex, if the "Not Started" button is clicked then:
Filter(Work Tasks, Completed = Completed.'Not Started')​​
Hope this helps!