cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lknudson1
Advocate II
Advocate II

conditional fill coloring formatting in gallery for iOS not working

I have a gallery that has a date field from a SQL data source that I want to have a conditional fill color applied based on the date being equal to a selected date on the main screen.  This works fine in development mode and run mode in Windows.  When I open the app in an iPad or iPhone, the fill for all date fields is black.  Here is the logic to pick color:

 

If(IsBlank(ThisItem.Stock_Date), White, // This checks to give default color if no date value
// if there is a date value, test if the gallery field date is equal to selected date
      If(DateValue(Text(ThisItem.Stock_Date,"[$-en-US]yyyy//mm//dd"))

       =

        DateValue(Text(DatePicker1.SelectedDate,"[$-en-US]yyyy//mm//dd"))  ,
                     Yellow, // if dates are equal, Fill will be Yellow
                      White) // if dates are not equal, Fill will be White
   )

Example from Windows run shows below as I want it with yellow fill for date when 08/05 is selected from date picker control on main screen.

But on iPad, fill will be black for all date fields in gallery.

Any help?

lknudson1_0-1628631679395.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
lknudson1
Advocate II
Advocate II

Well, I got it to work with what's below.  Not sure why iOS was so fussy.

 

If(!IsBlank(ThisItem.Stock_Date),
If(
DateValue(ThisItem.Stock_Date)
=
DatePicker1.SelectedDate,
Yellow, White),
White)

View solution in original post

3 REPLIES 3
RandyHayes
Super User
Super User

@lknudson1 

Please consider changing your Formula to the following:

If(IsBlank(ThisItem.Stock_Date), White, 
    ThisItem.Stock_Date = DatePicker1.SelectedDate, Yellow,
    White
)

See if that works better for you.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
lknudson1
Advocate II
Advocate II

Well, I got it to work with what's below.  Not sure why iOS was so fussy.

 

If(!IsBlank(ThisItem.Stock_Date),
If(
DateValue(ThisItem.Stock_Date)
=
DatePicker1.SelectedDate,
Yellow, White),
White)

View solution in original post

RandyHayes
Super User
Super User

@lknudson1 

So you're stating that the Stock_Date column in your list is a text column.  If so, then yes, this is key to remember that the PowerApps designer is very forgiving of type conversions (numbers to text, text to numbers, dates to text, etc).  However, the Play Apps on the mobile devices are NOT forgiving.  If they have any type conversion problems, they will just error out in the formula and in your case you would get a blank result for your color...which is black.

This is one of the main causes of "my app works fine in design mode, but when I play it on the app, it does not work - why?"

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

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!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,351)