cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Comparing value (text or number) against a Sharepoint List (Location data)

I'm trying to take lat, long, and altitude and compare it against a list in Sharepoint, so that if the values are in this list, the user is authorized to view these buttons that link to other pages. I am attempting to do this in the 'Visible' attribute. I've tried utilizing LookUp and IsMatch, but not finding an expression that works.  For example, the sharepoint is is 'Locations Accepted' and the columns are 'Lat', 'Long', and 'Alt'. The location is derived from the Location.X built into Powerapps. I was able to get it to match if I hardcode in a string that has coordinates, but I'm wanting to compare it to a list so I can add more coordinates to the list, and only approved coordinates will be able to view the buttons.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Re: Comparing value (text or number) against a Sharepoint List (Location data)

@Beeker 

I've not used the Location.X functions as yet but reading through the doc's and your post you could probably use Filter() & CountRows() to do what you need?

 

Something like this:

App.OnStart

 

// set Alt
Set(vAlt, Location.Altitude);

// set Lat
Set(vLat, Location.Latitude);

// set Long
Set(vLong, Location.Longitude);

// filter SP List
ClearCollect( colAccepted, 
    Filter('Locations Accepted', Lat = vLat && Long = vLong Alt = vAlt)
) 

 

 

Then on the button/s Visible property

 

// countrows of collection
If( CountRows(colAccepted) > 0, true, false)

 

 

EDIT: Whoops, I had a reply ready to send then got called away. Just came back and posted it to see @GarethPrisk has already replied. I will leave this in his capable hands 🙂 

View solution in original post

4 REPLIES 4
Highlighted
Super User II
Super User II

Re: Comparing value (text or number) against a Sharepoint List (Location data)

What are the data types of the columns in your SharePoint list? Specifically for lat/long.

PowerApps will give you latitude and longitude, but as a numeric value, so we'll need to make sure we're doing an appropriate match.

Also, latitude/longitude is very precise and even a slight variation won't allow a perfect match with the raw value. Are you rounding your lat/longs to any degree? If not, I recommend it, to give you a better likelihood of getting a match. Additionally, you may want to read up on physical distance related to lat/long coordinates, to allow you to set a radius of possible matching lat/longs.

For example, you have have latitude 85.1234000 but allow for values between 85.123 and 85.124 to match - I am not an expert on this, but presumably someone can recommend a numeric range.

Highlighted
New Member

Re: Comparing value (text or number) against a Sharepoint List (Location data)

I can save the column in share point (i assume) as text or number. I am guessing number would be best so I could do the distance from or range. Otherwise I was going to estimate to lesser decimals. I can deal with a range or exact location, I just need some guidance getting the expression working with a share point list (or any list for that matter, if it has to be embedded or something)

Highlighted
Super User II
Super User II

Re: Comparing value (text or number) against a Sharepoint List (Location data)

@Beeker 

I've not used the Location.X functions as yet but reading through the doc's and your post you could probably use Filter() & CountRows() to do what you need?

 

Something like this:

App.OnStart

 

// set Alt
Set(vAlt, Location.Altitude);

// set Lat
Set(vLat, Location.Latitude);

// set Long
Set(vLong, Location.Longitude);

// filter SP List
ClearCollect( colAccepted, 
    Filter('Locations Accepted', Lat = vLat && Long = vLong Alt = vAlt)
) 

 

 

Then on the button/s Visible property

 

// countrows of collection
If( CountRows(colAccepted) > 0, true, false)

 

 

EDIT: Whoops, I had a reply ready to send then got called away. Just came back and posted it to see @GarethPrisk has already replied. I will leave this in his capable hands 🙂 

View solution in original post

Highlighted
New Member

Re: Comparing value (text or number) against a Sharepoint List (Location data)

Thanks for your response! I had to change the Round.Down as I first had it in the "Filter" part of the formula, but it couldn't resolve the "=" to the Lat, Long, and Alt columns due to data type for some reason. But putting the RoundDown in the "Set(x, y)" piece accepted and is working! had to 

 

In the OnStart for App: 

Set(vLat, RoundDown(Location.Latitude,3)); Set(vLong, RoundDown(Location.Longitude,3)); Set(vAlt, RoundDown(Location.Altitude,3)); ClearCollect(userLoc, Filter('Locations Accepted', Lat = vLat && Long = vLong && Alt = vAlt))

 

Thank you for helping with this, I had to study the logic behind it all combined with your example, now it makes perfect sense to accomplish what I need

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (9,790)