cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Beat
Advocate V
Advocate V

Different results from same formula

I have a very weird issue. I use the following construct for the text property of a label:

If(LookUp(Filter('LCC Requests', StartsWith(gccDesc, varSelectedRFS)), empCountry = Label19.Text, Status.Value) = "New", "X", "Y")

This works perfectly fine. If the status of the first matching entry is "New", it returns "X", else "Y".

Now I want to use this construct to change the font color of some other control accordingly:

If(LookUp(Filter('LCC Requests', StartsWith(gccDesc, varSelectedRFS)), empCountry = Label19.Text, Status.Value) = "New", RGBA(0, 105, 117, 0.5), RGBA(0, 0, 0, 1))

While this is giving me the expected result and the font color changes as desired, there is an error:

The requested operation is invalid. Server Response: LCC Requests failed: The query is not valid.

I researched this, there are many posts about the issue, but I couldn't find one that would resolve this.

I can confirm that varSelectedRFS and Label19.Text are never null or empty (in which case the first construct would fail as well anyway). What could be causing this error, am I missing something?

1 ACCEPTED SOLUTION

Accepted Solutions

@iAm_ManCat while it is not really a solution, you put me on the right track. There's no point in checking if the variable is null, because it is never null in any context where it is being used. The app was running perfectly fine, the errors were only thrown when editing the app! 

 

My solution: rather than setting the variable to "", set it to "_void" (or any string) so it won't ever be empty. No more errors!

View solution in original post

2 REPLIES 2
iAm_ManCat
Super User
Super User

What happens when varSelectedRFS is blank - I would imagine this is where the issue is occurring. You can work aroudn that by including a check for blank:

 

If(
   LookUp(
          Filter('LCC Requests',
                 Len(varSelectedRFS)=0
                 ||
                 StartsWith(gccDesc, varSelectedRFS)
           ),
           empCountry = Label19.Text,
           Status.Value
   ) = "New", 
   "X", 
   "Y"
)

 

Could you try that and let me know if the error is resolved or else if there's new errors?

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


@iAm_ManCat while it is not really a solution, you put me on the right track. There's no point in checking if the variable is null, because it is never null in any context where it is being used. The app was running perfectly fine, the errors were only thrown when editing the app! 

 

My solution: rather than setting the variable to "", set it to "_void" (or any string) so it won't ever be empty. No more errors!

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,487)