We will learn and understand Compass, Connection & Location functions in Power Apps. Before we start, make sure to subscribe to CRM Crate so that you can stay up to date in the field of Power Platform.
What is Power FX?
Microsoft’s Power Fx is the low-code language that will be used across Power Platform. It’s a strong-typed, general-purpose, declarative, and functional programming language. Power Fx is expressed in user-friendly text. It’s a low-code language that citizen developers & makers can work with directly in an Excel-like formula bar or Visual Studio Code text window.
It enables a complete range of development from no-code for those who have never programmed before to “pro-code” for the seasoned professional, with no learning or rewriting cliffs in between, enabling diverse teams to collaborate and save time and expense.
Understanding Compass function
Syntax
Compass./Action/
The Compass signal returns the compass heading of the top of the screen. The heading is based on magnetic north.
Example
Compass.Heading
Heading in degrees. Returns a number 0 to 360, and 0 is north.
Understanding Connection function
Syntax
Connection./Action/
The Connection signal returns the information about the network connection. When on a metered connection, you may want to limit how much data you send or receive over the network.
Example
Connection.Connected
Returns a Boolean true or false value that indicates whether the device is connected to a network.
Connection.Metered
Returns a Boolean true or false value that indicates whether the connection is metered.
Understanding Location function
Syntax
Location./Action/
The Location signal returns the location of the device based on the Global Positioning System (GPS) and other device information, such as cell-tower communications and IP address.
When a user accesses the location information for the first time, the device may prompt that user to allow access to this information.
Example
Location.Altitude
Returns a number that indicates the altitude, measured in meters, above sea level.
Location.Latitude
Returns a number, from –90 to 90, that indicates the latitude, as measured in degrees from the equator. A positive number indicates a location that’s north of the equator.
Location.Longitude
Returns a number, from –180 to 180, that indicates the longitude, as measured in degrees from Greenwich, England. A positive number indicates a location that’s east of Greenwhich.
Implementing SetFocus function in Canvas App
In this scenario, we have stored the logged-in user’s location (Latitude & Longitude) in the variables which is later passed in the map as shown below.