cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lolla70
Helper IV
Helper IV

Formula and Black Box for few users.

I have this code in a lbltext. Some employees can see the results on the label text and few can't see it, it turn to black box.. I contacted Microsoft and they didn't solve the issue yet.

 

In the If(!IsBlank code when I change the User().Email to VarUserEmail the box turn black too. So I want to see if there is something wrong with the code. I know I have a Delegation Warning. Can someone check the code?

 

 

If(
First(
Sort(
Filter(
'Back to Work Eligibility',
Employee.Email = VarUserEmail
),
'Next Check-In Date',
Descending
)
).'Next Check-In Date' < Now(),

"Self-Assessment Required",


If(!IsBlank(Last(Filter('Back to Work Eligibility', Created>Today(),'Created By'.Email = User().Email, Result).Result).Result), Last(Filter('Back to Work Eligibility', Created>Today(),'Created By'.Email = User().Email, Result).Result).Result))

20 REPLIES 20

Can I put instead of Red the RGBA(192,0,0,0.8)?

Yes, you are correct. They are getting only Red Box nothing on it!!!

RandyHayes
Super User
Super User

@lolla70 

So there is your issue...the are getting nothing in the Text of the control and your Fill formula does not account for blank, and thus returned Black.

 

Yes, you can set that to whatever color you want, but if you specify nothing, then black is what you get.

 

So, in other words, if that control is always expected to have some text in it, then the problem is with your Text property of the control, not with the fill.

 

And looking again at your Text property formula, you are not accounting for no result in your formula there.

In other words, you are either setting the text to "Self-Assessment Required" or what is in the Last record of the filter you have...what if there is no record returned from that?  You are not setting it to anything then and it will be blank.

_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

How if I put it like this

 

With(
{_usr: User()},
If(
First(
Sort(
Filter(
'Back to Work Eligibility',
Employee.Email = VarUserEmail
),
'Next Check-In Date',
Descending
)
).'Next Check-In Date' < Now(),
"Self-Assessment Required",

If(
ListBox3_1.Selected.Value = "Home",
"Work from Home",
ListBox4_1.Selected.Value = "Yes",
"Work from Home, contact HR",
ListBox5_1.Selected.Value = "Yes",
"Work from Home, contact HR",
ListBox5_2.Selected.Value = "Yes",
"Work from Home, contact HR",
ListBox5_2.Selected.Value = "No",
"Clear for Office/Field work",
Last(
Filter(
'Back to Work Eligibility',
Created > Today() && 'Created By'.Email = _usr.Email
)
).Result
)
)
)

RandyHayes
Super User
Super User

@lolla70 

You could, but how are you setting the selected Item of the listbox?  You cannot set listbox items except by user selection.

_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

I created a Back Result Share point List

Title         Outcome

Yes          Work From Home, contact HR

No           Clear for Office/Field work

 

The in powerapps, I created List box for each question from the items from 'Back Result' and Value Title.

 

My problem is not sure how to add in this code the list box cause I have 4 list boxes "Yes & No".

 

With({_usr: User()},
If(
First(
Sort(
Filter('Back to Work Eligibility', Employee.Email = VarUserEmail),
'Next Check-In Date', Descending
)
).'Next Check-In Date' < Now(),
"Self-Assessment Required",

Last(Filter('Back to Work Eligibility', Created>Today() && 'Created By'.Email = _usr.Email)).Result
)
)

 

and here is the the Patch on teh Submit button

With({_user: User()},

Patch(
'Back to Work Eligibility',
Defaults('Back to Work Eligibility'),
{
Title: "Status from " & _user.FullName & " on " & Text(Today(), ShortDate),
'Check-In Date': Today(),

Result: lblResult_1.Text,
'Working Location': lblWorkingFrom_2.Text,
'Office Location': OfficeLocation.Text,
'Next Check-In Date': DateAdd(Today(), 1, Days),
Employee: {
Claims: "i:0#.f|membership|" & Lower(_user.Email),
Department: "",
DisplayName: _user.Email,
Email: _user.Email,
JobTitle: "",
Picture: ""
}
}
)
);
Navigate(scrMain, ScreenTransition.Fade);

 

 

RandyHayes
Super User
Super User

@lolla70 

Can you explain more about what you mean about adding the formula to a listbox?

_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

I meant how I to add the ListBox Outcome to the lblResult_1

I did this on lblResult_1 Text Code but it didn't work. I know I am still missing on how to get the result to SharePoint when users answer their question. Unfortunately can't figure it out.

If(
First(
Sort(
Filter(
'Back to Work Eligibility',
Employee.Email = VarUserEmail
),
'Next Check-In Date',
Descending
)
).'Next Check-In Date' < Now(),

"Self-Assessment Required",
If(
ListBox3_2.Selected.Value = "Home",
"Work from Home",
ListBox1.Selected.Title = "Yes",
"Work from Home, contact Zac Elliott or Kari Rahn",
ListBox1_1.Selected.Title = "Yes",
"Work from Home, contact Zac Elliott or Kari Rahn",
ListBox1_2.Selected.Title = "Yes",
"Work from Home, contact Zac Elliott or Kari Rahn",
ListBox1_2.Selected.Title = "No",
"Clear for Office/Field work"
)
)

 

RandyHayes
Super User
Super User

@lolla70 

I guess I am just missing the concept of what you are doing.  I am not sure where the listboxes come in, but in general, you cannot have anything in your app rely on the listboxes to be anything except selected by the user.  You cannot set the default selected items of a listbox, so, I am assuming this formula for the label comes somewhere after that is done.

 

 

_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

I sent you private message, can you please check if possible?

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,908)