cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Change record table on date change

I have a Button with text set to

If(DateValue(ThisItem.DUE) >= Today(),"Testing", ThisItem.Status)

with Fill conditioned to different colors. 

 

I have a counter with Text set to: 

 

CountRows(Filter(Table2Data,Status="Testing"))

 

 

What I want to do is have the button change it's status to "Testing" if the date in the record is today or greater. 

The above Button code changes the text to "Testing" BUT it does not change the record.  Therefore, the counter does not count it and the color of the button does not change. 

 

I tried to add the Patch() formula but I got an error back saying the Patch can only be used in action properties.  

 

Anyone have any idea?

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

From your picture, you set Button1.Fill based on Button1.Text.

 

However, on the side you also set your Button.Text based on Button1.Fill (Meaning that none can be set as both look at each other to be set) that is giving you the circular reference error. Remove any mention of Button1.Fill from Button1.Text

View solution in original post

8 REPLIES 8
JRaasumaa
Memorable Member
Memorable Member


@Anonymous wrote:

I have a Button with text set to

If(DateValue(ThisItem.DUE) >= Today(),"Testing", ThisItem.Status)

with Fill conditioned to different colors. 

 

I have a counter with Text set to: 

 

CountRows(Filter(Table2Data,Status="Testing"))

 

 

What I want to do is have the button change it's status to "Testing" if the date in the record is today or greater. 

The above Button code changes the text to "Testing" BUT it does not change the record.  Therefore, the counter does not count it and the color of the button does not change. 

 

I tried to add the Patch() formula but I got an error back saying the Patch can only be used in action properties.  

 

Anyone have any idea?


 

Have you tried just putting your collection's conditional statement into the CountRows?

 

CountRows(Filter(Table2Data, DateValue(ThisItem.DUE) >= Today()))
Anonymous
Not applicable

2017-10-16_13-08-15.jpg

 

So tried it but it's still only counting the Rows in the Excel table that have status as Testing and date >= today.  Plus as you can see in the image, the conditional fill isn't filling it yellow.  But the formula is successfully changing the text to "Testing" based on the date. 

Anonymous
Not applicable

How is your Fill formula setup? You are changing the Button.Text based on date. The Text does not represent the actual status that is stored in the data source. If your Fill is setup by looking at your data source then it is no wonder that it is displaying the wrong colors. If you want to keep your setup and still display correct color based on the Button.Text then setup your Button.Fill using the Text property not the Status that is in the data source. It would be something like this:

Switch( 
  Button.Text,
  "Testing",Yellow,
  "Passed",Green
)

 Now when you CountRows you are again counting rows that in the data source have status as Tested not the ones that have Button labeled as testing. To count only rows that have button as tested you can do this:

CountRows(
Filter(
YourGallery,
Button.Text = "Testing"
)
)
Anonymous
Not applicable

So the fill gives back a circular refrence error and the CountRow is giving an invalid argument.

 

I'm trying to see if a work around can be putting a shape that has a fill property as above, and just putting a label on top of it for the status 

 

Anonymous
Not applicable

Can you show me screenshot of your codes with an error? I have just tested it out and it works as expected.

 

Color coding:

3.png

 

CountRows:

4.png

Anonymous
Not applicable

1.jpg

 

 

 

The status bars on the right is a label over a shape so ignore those.  The error is coming from the ones that are supposed to be on the left

Anonymous
Not applicable

From your picture, you set Button1.Fill based on Button1.Text.

 

However, on the side you also set your Button.Text based on Button1.Fill (Meaning that none can be set as both look at each other to be set) that is giving you the circular reference error. Remove any mention of Button1.Fill from Button1.Text

View solution in original post

Anonymous
Not applicable

My mistake lol 

 

Thank you for your help!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,218)