cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
thunter
Level 8

Re: UpdateContext and Visibility

so the sheet is actually titled PendingRequests so not sure if I shoudl use that or PendingRequestsTable, here is my Excel

thunter
Level 8

Re: UpdateContext and Visibility

I tried using both PendingRequest_Table and PEndingRequests but neither works. It says 'Invalid Name' for PEndingRequest_Table.

 

nickduxfield
Level 8

Re: UpdateContext and Visibility

If the Approve Requests button is not placed in the Gallery, the formula Patch(Table, thisItem, {}) wont work.

Here are your options.

  • Put Approve an Reject Buttons directly in the gallery then Patch(PendingRequests_Table, thisItem, {Status:"Approved"})
  • Change the code to: Patch(PendingRequests_Table,NameofYourGallery.Selected, {Status:"Approved"})

NameofYourGallery.Selected could be the entry PendingRequests, if not, try name all your galleries to Gallery_SomeName so you can bring them up in your code quickly with no confusion.

 

More info: If you want to do conditional patches that evaluate everyline, try UpdateIf(source, condition, {})

 

Ps sorry for jumping in there, I havent answered questions for sometime and Im starting to enjoy it again.

Regards

 

 

thunter
Level 8

Re: UpdateContext and Visibility

Okay, the Approve and Deny buttons are in the Gallery. But still getting an error:

nickduxfield
Level 8

Re: UpdateContext and Visibility

Investigate the Status field.

What type of field is it?

If it is a complex type, meaning, Status is found in a complextype field that has dependencies.

The error suggests that the Status filed is not what you were expecting, either you changed it to Date and Time by accident, or it is a complect type filed titled status, containing sub fields, or something else.

 

I.e. 

PendingRequest_Table( {Title:"",Status: { StartDate:000000,EndDate:00000 } } )

In this case above you might have to patch the whole thing:

Patch( PendingRequest_Table, Thisitem, {Status: { StartDate:MyDate,EndDate:MyDate}}) 

 

If you are able Im happy to sharescreen with you to find out further.

 

thunter
Level 8

Re: UpdateContext and Visibility

So the Status column must have been formated wrong. I changed it to Text and now it is working. Now my next goal is to show only the Approved requests on the ApprovedRequest Screen and the Denied requests on the DeniedRequest Screen. I am thinking I an do this with Filter or is there an easier or better way?

thunter
Level 8

Re: UpdateContext and Visibility

nickduxfield
Level 8

Re: UpdateContext and Visibility

You should not need 2 screens for this unless formatting is too dissimilar.
Pass a context variable on navigate(screen2, transition, {statevariable:2})
Or write to a column in a temp collection that can control States of all screens. Like approved =1, denied =2.
Use a switch case on a gallery to setup filters for each mode.
nickduxfield
Level 8

Re: UpdateContext and Visibility

If using a contextvariable "StateVariable"

Button.OnSelect

Switch(StateVariable,

1,UpdateContext({StateVariable:2}),

2,1,UpdateContext({StateVariable:2})

)

 

Gallery Items

Switch(StateVariable,

1,

SortByColumns(Filter(PendingRequest_Table, Status="Approved"),"DateSubmitted",Descending),

2,

SortByColumns(Filter(PendingRequest_Table, Status="Rejected"),"DateSubmitted",Descending)

)

 

Please enure you understand the field types

thunter
Level 8

Re: UpdateContext and Visibility

So on this same screen I just have a Label that will show ThisItem.Status. Is there a way to set the color depending on if it is Approved, Pending or Denied?

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,508)