Maplytics in Canvas App
Last updated
Was this helpful?
Last updated
Was this helpful?
Maplytics can be integrated into the Canvas App. Following are the steps for the same.
Configuring Maplytics in the Canvas App
Follow the steps below to configure Maplytics in the Canvas App.
Enabling Publishing of Canvas Apps with Code Components
Before configuring the Canvas App, ensure the "Allow publishing of canvas apps with code components" setting is enabled.
To enable this setting:
1. Open the Power Platform admin center.
2. Navigate to Manage and select Environment. Now, Go to Settings -> Features.
3. Scroll down to the Power Apps component framework for canvas apps.
4. Toggle "Allow publishing of canvas apps with code components" to On.
Once enabled, users can create canvas apps and configure Maplytics in the Canvas App.
After creating the Canvas App, the user can enhance it by adding the Maplytics List Control to visualize and analyze location data within the app. Simply insert the Maplytics components and configure them with the required data sources to enable interactive mapping features. Once added, you can proceed with integrating relevant data to optimize your app's functionality.
To add data to the app:
Go to the Data option from the Site Map.
Click on the Add Data button.
Search for and select the table to bind to the Canvas App (e.g., Accounts).
Additionally, add the following entities:
Inogic License Details
Maplytics Configuration Details
Users
After this, import the component into the Canvas App.
Click on the Import Components button in the Components tab of the Tree View section. Then, navigate to the Code tab, locate Maplytics List Control, and click on Import.
Note: The Code tab will be accessible only after enabling the Power Apps component framework for canvas apps in the Admin Center.
After importing, the Maplytics List Control will appear under the Code Components option in the Insert section.
Alternatively, the user can import it using the Get More Components option in the Insert section.
Now, we need to import the Maplytics Connector. Follow these steps:
● Click on the Get more components option.
● Navigate to the Canvas tab in the Import Components section.
● Look for the Maplytics Canvas App Connector.
● Select it and click on Import.
Users can also add the Code and Library component using the "Insert" button in the command bar.
After importing the Maplytics Connector, it appears under Library Components. Select and add it to the Canvas App screen.
Next, click on the Maplytics List Control under the Code Components option and add it to the screen.
Note:
1. Resize the Code Component by dragging its corners to ensure it fully utilizes the screen.
2. Make sure the Maplytics Connector is behind the Maplytics List Control, and it can be reordered.
With the import process complete, the next step is binding data to the properties of the Maplytics List Control.
Select the required table (e.g., Accounts) in the Dataset_Display_Key (Items) property to configure the data in Maplytics.
Next, select the appropriate view (e.g., All Accounts) for the chosen table.
After that, click on the Edit button to select the fields to add to the view.
Note: Since the Maplytics List Control plots pushpins on the map based on latitude and longitude values, make sure to select the Latitude and Longitude fields.
Next, add Power Fx formulas to the other dataset properties.
Select the InogicLicenseDetails_Items (Items) property and enter the following Power Fx formula in the formula bar:
IfError(First(Filter('Inogic License Details', 'Product Name' = "Maplytics" && !IsBlank('License Key') && Status = 0)), Blank())
Similarly, add the following Power Fx formulas for the
MaplyticsConfigurationDetails_Items (Items) and SystemUser_Items (Items) properties.
Power Fx formula for MaplyticsConfigurationDetails_Items (Items):
Filter('Maplytics Configuration Details', User.'Full Name' = User().FullName)
Power Fx formula for SystemUser_Items (Items):
Filter(Users, domainname = User().Email)
Next, set the InitConfigurationDetails property. Here, use the output parameter of the connector.
If the connector name is Maplytics_Connector_1, then the Power Fx formula will be:
Maplytics_Connector_1.ConnectorOutputParams
Now fill in a few more important properties:
● Map Mode
● Map Key
● Latitude
● Longitude
● Proximity
● Distance Unit
● Optimize Route By
● Navigate To
● Full Address
For the Map Key field, you need to provide the Azure Maps key. You can either:
Enter the key directly in the text field next to the Map Key label.
Enter the key in the formula bar, enclosed in double quotes ("").
The same applies to the Latitude and Longitude fields, where the logical name must be provided. These values can be entered directly in the text field or in the formula bar within double quotes ("").
For the Proximity field, set a default value so that when the app is opened, a proximity radius will be plotted on the map using the device's current location. This is a mandatory field, and by default, the value is set to 5.
● The maximum value for the proximity radius is 2000.
For the Distance Unit, select the default unit to be used on the map when the app is opened. The available options are:
● Kilometers
● Miles
Next is the Optimize Route By option, which determines how routes are optimized when using the Route feature.
The available options are:
● Shortest Distance – Prioritizes the shortest possible route based on travel distance.
● Shortest Time – Prioritizes the fastest route based on travel time considering traffic and road conditions.
The selected option will be used as the default setting when the Route feature is utilized.
Next comes the Navigate To property, where users need to select the default map application for navigation when using the plotted route.
The available options are:
● Google Maps
● Waze
● Apple Maps
The route from Maplytics will open in the selected default map.
Next is the Full Address property which is optional.
● Here, you can provide the logical names of the address fields in the desired order.
● These fields will be displayed in the Tooltip card of the record.
● The logical names should be comma-separated.
Example:
address1_street1,address1_city,address1_state,address1_postalcode,address1_country
Now that the configuration part is complete, there is one recommended setting to adjust for a better user experience.
Click on the Gear Icon/Settings from the left panel.
Go to the Display section.
Locate the Lock Aspect Ratio toggle option.
By default, this option is On—we recommend turning it Off for a better user experience.
Now, Save and Publish the app by following these steps:
Click on Save to ensure all changes are stored.
Click on Publish this version to make the app available for use.
After publishing, follow these steps to run your app:
Go to the Apps option from the left panel in Power Apps.
In the My Apps section, locate the app you created.
Click on Play to launch and use the application.
For mobile users: Users can open the app directly from the Power Apps mobile application.