cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Siamak
Helper II
Helper II

AND operator within Lookup works in Chrome but not other browsers

Hi

I read a value from my SharePoint list into a Text Input box in my PowerApp using the Lookup function. The value I am reading is the unique record ID and the code I use is: 

LookUp(sessDetailsCollection, And(StartDateConverted=ConvertedStartDateValue.Text, SessionTitle='Sess-Title-Dropdown'.Selected.Result),'Session ID')

 I get no error messages but when I run the app it all works fine in Google Chrome but no other browser. I have tested Edge, Firefox and Opera and they all have problem retrieving the record ID. When I remove the AND operator, the app works fine in all browsers. I have also tested this with nested filter within Lookup function: 

LookUp(Filter('Session details',SessionTitle='Sess-Title-Dropdown'.Selected.Result),StartDateConverted=ConvertedStartDateValue.Text,'Session ID')

and get the same result.

I did some experiment with Collection. And, yes, you guessed! The same result. Is this a bug in PowerApps? Or browsers?

 

Thank you in advance

 

1 ACCEPTED SOLUTION

Accepted Solutions
Siamak
Helper II
Helper II

Just to update you on this issue, after a lot of head scratching and experimenting with several different approaches, it occurred to me  that if I add a date format within by code, it may work. And it did! To be specific, I added the code en-GB goes selectedText.value.

Here is the working code:

Text(DateTimeValue(StartDateDropdown.SelectedText.Result,"en-GB"),"ddmmyyyyhhmm")

View solution in original post

9 REPLIES 9
Drrickryp
Super User
Super User

@Siamak 

 Try

With({sdc:Filter(
                 sessDetailsCollection, StartDateConverted=ConvertedStartDateValue.Text 
          ) 
     },
     LookUp(
            sdc,SessionTitle='Sess-Title-Dropdown'.Selected.Result,'Session ID'
      )
)

 If that doesn't work then put a datatable on the screen and set its Items property to 

Filter('Session details',SessionTitle='Sess-Title-Dropdown'.Selected.Result)

and see if it populates with the data you are expecting.  

 

 

 

 

Thank you for your reply. I'll try your suggestion as soon as I can and get back to you. But I am still puzzled about why the code works with Chrome and not others. Perhaps we will never know.

 

Siamak
Helper II
Helper II

I just tried your first suggestion and had no luck. Will try the other one soon. Can you explian what you mean by "put a datatable on the screen"? 

 

Many thanks

Drrickryp
Super User
Super User

@Siamak 

A datatable control.  It's like a gallery but has less options and more built in features for displaying a table datasource.

Drrickryp
Super User
Super User

@Siamak 

I like to use them for troubleshooting so i can visualize tabular data quickly. 

Siamak
Helper II
Helper II

I tried that too. But still no joy! The odd thing is that the code obviously works - but only in Google Chrome. I have been wondering what is especial about Chrome. And why should the choice of browser affect thing in this way. Surely the browser has not role in determining how the data is handled/retrieved and just displays what is served to it by Sharepoint/Powerapps . So I'd appreciate if anyone could shed light on this

 

Ok, I have now discovered the source of the problem but still have no solution. 

To retrieve the Session ID I use the start date and time converted into a number. Here is the code:

Text(DateTimeValue(StartDateDropdown.SelectedText.Value),"ddmmyyyyhhmm")

  The problem is that all browsers interpret "ddmmyyyy..." format as "mmddyyyy..." (12/09/2022 becomes 09122022) except for Chrome which interprets the conversion correctly ie 12092020. Very strange. I get the same error, btw, when I add the link in MS Teams. In PowerApps on mobile devices, it all works perfectly  

Siamak
Helper II
Helper II

Just to update you on this issue, after a lot of head scratching and experimenting with several different approaches, it occurred to me  that if I add a date format within by code, it may work. And it did! To be specific, I added the code en-GB goes selectedText.value.

Here is the working code:

Text(DateTimeValue(StartDateDropdown.SelectedText.Result,"en-GB"),"ddmmyyyyhhmm")

Great stuff, thank you Siamak! 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,189)