cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Connor_Taylor
Resolver I
Resolver I

LookUp function only working sometimes

Hello,

 

I am using powerApps custom visual for power BI.


I have a function:

If(Not(IsBlank(LookUp(PowerBIIntegration.Data, Value = 39).Value)) ,NewForm(Form1);Navigate(Sub,ScreenTransition.Fade),If(Not(IsBlank(LookUp(PowerBIIntegration.Data, Value = 40).Value)),Navigate(Screen2,ScreenTransition.Fade),NewForm(EditForm1);Navigate(BrowseScreen1_1,ScreenTransition.Fade)))

Basically:
 - If the value is 39 THEN navigate to a form page
 - If the value is 40 THEN navigate to a different page
 - Else navigate to a different page

 

But this only works SOMETIMES, as if the conditional statements are ignored and navigates to the 'Else' page.

Anyway to fix this, or is this an issue?

 

Thank you

Related and previous post here

 
19 REPLIES 19

I now have the formula

If(
    !IsBlank(First(Filter(PowerBIIntegration.Data, Value=39))), 
        Navigate(Sub,ScreenTransition.Fade); NewForm(Form1),
    !IsBlank(First(Filter(PowerBIIntegration.Data, Value=40))),
        Navigate(Screen2,ScreenTransition.Fade),NewForm(EditForm1),
Navigate(BrowseScreen1_1,ScreenTransition.Fade))

Which passes no errors.

But doesn't work as intended at all.

Is there something wrong in my logic?

Hi @Connor_Taylor,

It looks like it should work.  Lets try an experiment.

Set up a button to create these variables: 
UpdateContex({Result1: Navigate(Sub,ScreenTransition.Fade); NewForm(Form1),
Result2: Navigate(Screen2,ScreenTransition.Fade);NewForm(EditForm1)})

If(
    !IsBlank(First(Filter(PowerBIIntegration.Data, Value=39))), 
        Result1,
    !IsBlank(First(Filter(PowerBIIntegration.Data, Value=40))),
        Result2,
Navigate(BrowseScreen1_1,ScreenTransition.Fade))

@Drrickryp,

Seems you can't have semicolons in the UpdateContext function, it's giving an error

Also, I think i found an error in your formula.  There is a comma that should be a semicolon.

If(
    !IsBlank(First(Filter(PowerBIIntegration.Data, Value=39))), 
        Navigate(Sub,ScreenTransition.Fade); NewForm(Form1),
    !IsBlank(First(Filter(PowerBIIntegration.Data, Value=40))),
        Navigate(Screen2,ScreenTransition.Fade); NewForm(EditForm1),
Navigate(BrowseScreen1_1,ScreenTransition.Fade))

Maybe it will work now. 

@Drrickryp,

 

Nice spotting, corrected it but still navigates to the 'Else' page.

As if the 'If' statement returns false even when the value is either 39 or 40

Just a follow up for more information,

 

The lookup doesn't seem to work when the app takes longer to load.

This definitely doesn't seem to be working as intended

Hi, @Connor_Taylor...

 

I haven't worked a lot with PowerBI Custom Visuals, but I'm wondering if something is happening with the IsBlank text. Using IsBlank to test a Collection will return false even if the Collection has nothing in it. I'm wondering if that is part of what is going on. Can you do a little troubleshooting?

Put a button and a couple textboxes on your form. At the point that you would typically execute your formula, click this button, instead.

OnSelect: 

UpdateContext({
my39: First(Filter(PowerBIIntegration.Data, Value=39)).Value,
my40: First(Filter(PowerBIIntegration.Data, Value=40)).Value,
my39Boo: IsBlank(First(Filter(PowerBIIntegration.Data, Value=39))),
my40Boo: IsBlank(First(Filter(PowerBIIntegration.Data, Value=40))),
 my39FieldBoo: IsBlank(First(Filter(PowerBIIntegration.Data, Value=39)).Value),
my40FieldBoo: IsBlank(First(Filter(PowerBIIntegration.Data, Value=40)).Value),
})

Fill the textboxes with some concatenation of these variables (or have 6 boxes, each assigned one variable). Let's make sure you are getting the right returns from each part of the formula, and whether the field notation matters.

@TimRohr Thanks for the help,

 

Created exactly as you said and I get the intended results
pa.JPG

And then for the 39 result I get:

my39: 39 | my40:
my39boo: false | my40boo:true
my39FieldBoo: false | my40FieldBoo:true


Which is exactly what I am after.

I believe the issue stems from using an 'onTimerEnd', but this step needs to be automated

koolsin
Frequent Visitor

your PowerApps is Bad thing , i use both Lookup and First(Filter   is not found in Excel Database 

"PF2M" Why  it found  Before and After But can't see it i use trim for cut " " ready

Please Help me , My Boss is Angry Me that make Suck Application , although it not my fault  

Haripriya_15
Regular Visitor

Hello there,
Transfer the data into a collection and use IsBlank() and Lookup() function for the collection instead of using it for the SharePoint record. This solved my issue.

Happy to help!

Regards,
Haripriya G

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 (2,103)