cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nliu
Helper II
Helper II

How to change an icon color when a form is completely fill ?

Hello,

 

I've got this form and I would like that the dockcheck icon turn green when the form is 100% filled, orange when it's filled at 50% and red when it's unfilled.

 

I tried to use this formula but something's wrong.

 

Can you help me ?

Thank you

Capture.JPG

 

1 ACCEPTED SOLUTION

Accepted Solutions
SeanHenderson
Power Participant
Power Participant

Hi @nliu 

You can use variables.

Set the OnChange properties of your controls to:

Set(varColor, 1)

and add to the submit form button:

Set(varColor, 2) 

And set the color property of your icon to:

If(varColor = 1, Orange, varColor = 2, Green, Red)

 

---
Please hit the "Accept as Solution" button if my post answered your question! If my post was helpful please consider giving it a "Thumbs Up."

View solution in original post

3 REPLIES 3
SeanHenderson
Power Participant
Power Participant

Hi @nliu 

You can use variables.

Set the OnChange properties of your controls to:

Set(varColor, 1)

and add to the submit form button:

Set(varColor, 2) 

And set the color property of your icon to:

If(varColor = 1, Orange, varColor = 2, Green, Red)

 

---
Please hit the "Accept as Solution" button if my post answered your question! If my post was helpful please consider giving it a "Thumbs Up."

Thank you ! 🙂 

v-siky-msft
Community Support
Community Support

Hi @nliu ,

 

How to define the 50% complete of form?  I assume the 50% means half of controls are filled.

We can use Isblank and IsEmpty function to check if the field is filled. Please check my test.

My Form contains four data cards, three text input boxes and one combo box.

1. create a collection, its number of items is based on the number of data card. there are four cards, so the collection has four items with Id column and value column, Id column is for the index corresponding to field respectively, and the value column is for storing fill status. Set the following codes to OnStart property of App.

 

ClearCollect(Collection1,{id:1,value:0},{id:2,value:0},{id:3,value:0},{id:4,value:0})

 

2. once the field is changed, check if the field is empty, if empty, patch 0 the value column of the corresponding row, if filled, patch 1.

so the first data card field fill status will only be stored to the first record of collection.

set the following codes to OnChange of Textinput or combo box, use Isblank function to check text box, and use IsEmpty function to check combo box.

 

If(IsBlank(DataCardValue43.Text),Patch(Collection1,LookUp(Collection1,no=1),{value:0}),Patch(Collection1,LookUp(Collection1,no=1),{value:1}))

 

or

 

If(IsEmpty(DataCardValue44.SelectedItems),Patch(Collection1,LookUp(Collection1,no=2),{value:0}),Patch(Collection1,LookUp(Collection1,no=2),{value:1}))

 

3. after all field OnChange property has been set, put the following codes to Color property of icon. Judge the table completion progress based on the sum of column 'value'.

 

If(Sum(Collection1,value)=4,Green,Sum(Collection1,value)>=2&&Sum(Collection1,value)<4,Orange,Sum(Collection1,value)>=0 && Sum(Collection1,value)<2,Red)

 

Snipaste_2020-01-09_16-56-01.pngSnipaste_2020-01-09_16-57-30.pngSnipaste_2020-01-09_16-57-14.png

Sik

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,806)