cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JGootee
Level: Powered On

Stuck on how to set a field with alternating value, and then filter by that field

When a Helpdesk request form is submitted I need the hidden QA Group text field to be populated with the value 'QA Review 1', then next time the form is submitted, populate QA Group field with 'QA Review 2', alternating this value each time the form is submitted.  Do I need to use an UpdateContext variable in the OnVisible property of the screen that holds the form, and set the Default value of the QA Group field to the UpdateContext variable?

 

Then filtering question on this is that this app has a QA Review screen with a gallery for the QA review team to select and review tickets. Team wants to click one of three buttons to filter the list by the values in th QA Group field. I am struggling with the OnSelect statement for those three buttons, and how to express the Filter statement in the Gallery Items property.  Do I want to use another UpdateContext variable in the Select statement for each button?

 

QAReviewSetAndFilter.png

 

Thanks for  your help!

 

1 ACCEPTED SOLUTION

Accepted Solutions
KroonOfficeSol
Level 10

Re: Stuck on how to set a field with alternating value, and then filter by that field

@JGootee

 

On the both button.OnSelect you do

UpdateContext({cvarQAReviewGroup:""})

 

 

Then on the Gallery.Items

SortByColumns(
	Filter('CSS Request Form Copy'
		, RequestStatus="5 - QA Review"
		,IsBlank(cvarQAReviewGroup) || QAReviewGroup=cvarQAReviewGroup
		)
	, "CSSDueDate"
	,If(SortDescending1, Descending, Ascending)
)

 

  • In the filter adding a condition (with the , character) you basically do an AND statement, so using this makes it easier to read.
  • The IsBlank(Variable) give a true on a empty string, so returns all the records


Greatings Paul

4 REPLIES 4
KroonOfficeSol
Level 10

Re: Stuck on how to set a field with alternating value, and then filter by that field

@JGootee


Yes you want to use UpdateContext() and set a variable to filter your gallery.

 

Spoiler
Btw, It should be even better when this state is a related list, which contains an ID column. Then you set the ID to a field and show the Name column to the user. An number is easier to filter and you will be able to change then names or add states in the future without needing to change your app on several places.

 

Hope this helps.


Paul

JGootee
Level: Powered On

Re: Stuck on how to set a field with alternating value, and then filter by that field

@KroonOfficeSol

Thanks Paul, that worked but I don't quite have it right yet.

 

I am setting the original desired variable on the Screen IsVisible property using this expression:

UpdateContext({cvarQAReviewGroup: "QA Review 1"}) 

 

That works great, and I added the filter on that variable to the Items property for the gallery:

Items = SortByColumns(Filter('CSS Request Form Copy', RequestStatus="5 - QA Review" && QAReviewGroup=cvarQAReviewGroup), "CSSDueDate",If(SortDescending1, Descending, Ascending))

 

And that toggles nicely for my QA1 and QA2 buttons that each update the context variable in their OnSelect expression to their respect value.

 

But where I am stuck is how to set the cvarQAReviewGroup variable to show both QA 1 and QA2 (ALL) records.   Is there an expression can set when clicking the Both button, and build that in to my Items property filter to show all records?

 

 

QAReviewBothButton.png

 

Thanks!!

Jgootee

 

PS> I am watching all of your YouTube videos - extremely valuable and the level/methodology I aspire to reach soon.  Thanks for making those!!

 

KroonOfficeSol
Level 10

Re: Stuck on how to set a field with alternating value, and then filter by that field

@JGootee

 

On the both button.OnSelect you do

UpdateContext({cvarQAReviewGroup:""})

 

 

Then on the Gallery.Items

SortByColumns(
	Filter('CSS Request Form Copy'
		, RequestStatus="5 - QA Review"
		,IsBlank(cvarQAReviewGroup) || QAReviewGroup=cvarQAReviewGroup
		)
	, "CSSDueDate"
	,If(SortDescending1, Descending, Ascending)
)

 

  • In the filter adding a condition (with the , character) you basically do an AND statement, so using this makes it easier to read.
  • The IsBlank(Variable) give a true on a empty string, so returns all the records


Greatings Paul

JGootee
Level: Powered On

Re: Stuck on how to set a field with alternating value, and then filter by that field

@KroonOfficeSol

 

Paul, your solution works perfectly.  Can't thank you enough for that. Kind regards. Jim