cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Beat
Continued Contributor
Continued Contributor

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
Beat
Continued Contributor
Continued Contributor

@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


Beat
Continued Contributor
Continued Contributor

@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
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (3,250)