cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Re: LookUp function only working sometimes

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?

Super User
Super User

Re: LookUp function only working sometimes

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

Re: LookUp function only working sometimes

@Drrickryp,

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

Super User
Super User

Re: LookUp function only working sometimes

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. 

Re: LookUp function only working sometimes

@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

Re: LookUp function only working sometimes

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

TimRohr
Level 10

Re: LookUp function only working sometimes

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.

Highlighted

Re: LookUp function only working sometimes

@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