This topic is locked

Dashboard map markers from a database field (table row) problem

4/3/2026 16:34:48
PHPRunner General questions
G
gtothill author

Hi all,

Im building on PHPR 11.2 Enterprise Build 44123.

I have a dashboard with a table showing rows of data from a country database. Each country has a risk rating that is represented by a field - alowed values are RED, AMBER and GREEN.

I use a calculated field in the sql query to generate another field called "map_marker_icon_path" which points at the icon I would like associated with each of the rows and therefore each of the map markers.

I also use a concatinated field that generated a field I can use as a description (label) for each of the map markers.

This all works perfectly when I edit a map that is on the normal list page. I can set the icon to the field "map_marker_icon_path" using $mapSettings['markerField'] = 'map_marker_icon_path';

However Im trying to do a similar thing with a map showing the same data on a dashboard page. The options here are much reduced although there is the option to set the map marker in php.

So I tried this: $icon = $value["map_marker_icon_path"];

But I just get the default icons instead of the various icons for each of the rows of the sorce table - also in the dashboard.

Can someone tell me how to do this so that the map in the dashboard uses the icons defined in that tables map_marker_icon_path field? Ie The right icon is displayed for each row according to the risk rating?

Or some other technique if that is more appropriate!

Thanks in advance,

Geoff.

ChatGPT 4/3/2026

Hi Geoff,

It sounds like you're on the right track with trying to set the marker icons dynamically based on the map_marker_icon_path field. However, the dashboard maps in PHPRunner can sometimes have different configurations compared to the regular pages.

Here’s a step-by-step approach to ensure that the dynamic icons work correctly on your dashboard map:

  1. Check Your Data Source: Ensure that the map_marker_icon_path field is correctly populated with the paths to your icons in the data source of the dashboard. You can do this by checking the SQL query used for the dashboard.


  2. Use the Correct PHP Code: In the dashboard setup, you typically have a place to set the PHP code for the map settings. Ensure that you're setting the marker path correctly, and that you're using the right variable to retrieve the icon path. Try the following code:

    $icon = $value["map_marker_icon_path"];
    $mapSettings['markerField'] = $icon; // Ensure you're setting the markerField to the icon path

  3. Debug the Output: You can add some debug statements to verify that the $icon variable is being populated correctly. For example, you can log it or echo it (if you can see the output on the dashboard).

    error_log("Map Icon: " . $icon); // Check your server's error log for output
  4. Configure the Map Settings: Depending on how the dashboard is set up, you might need to explicitly define other map settings. Make sure to configure other necessary settings for the map, such as the markers' description field.


  5. Clear Cache: Sometimes, changes might not reflect immediately due to caching. Clear the cache of your application and reload the dashboard page to see if the changes take effect.


  6. Check Documentation: Since you're using PHPRunner, consider checking the official documentation or forums for any specific nuances related to dashboard maps. There might be version-specific details that could help.


  7. Fallback Icon: If for some reason the dynamic icon doesn't load, consider setting a fallback icon in case the path is incorrect or the file is not found.


  8. Testing: As a last resort, if none of the above works, create a simple test dashboard with hardcoded values for the icon path to determine if the issue lies within the dynamic loading of the icon or elsewhere in the dashboard setup.



By following these steps, you should be able to ensure that the dashboard map displays the correct icons for each country based on the risk rating. If you're still having issues, you might want to reach out to the PHPRunner support community for more tailored assistance.

Good luck with your project!

Best,
[Your Name]

G
gtothill author 4/4/2026

Thanks ChatGPT!

Unfortunately none of your suggestions worked on this build.

Does anyone from the community know if this should be possible?

Thanks!

Geoff.

Sergey Kornilov admin 4/4/2026

The following part doesn't look right:
$value["map_marker_icon_path"];

Where did you find this syntax? When you insert a map there are comments that explain how to customize a marker.

G
gtothill author 4/5/2026

Thanks Sergey,

I also tried $data["map_marker_icon_path"];

I just wondered - the map I have embedded on the dashboard is from the same table as the data grid displayed on that dashboard. On the source list page I have a map with the following settings for the icon

// You can specify a custom marker icon.
// Enter either a file name for all markers:
// $mapSettings['markerIcon'] = 'images/Smile.png';
// Or specify a field from your SQL query that contains marker name:
$mapSettings['markerField'] = 'map_marker_icon_path';
// return "images/markers/pins/black-pin.svg";;
// The query field should contain a path tho the image file
// Leave both fields blank to use default marker.
// $mapSettings['markerIcon'] = '';
// $mapSettings['markerField'] = '';

This works perfectly on the list page - so in the map on the dashboard I wanted to do the same (because its ilogical in the application for all the markers to be red).

So I need to somehow set the $mapSettings['markerField'] variable for the map on the dashboard.

It seems the php extression for setting the marker icon expects $icon =

So I simply tried:

$icon = $data['map_marker_icon_path'];
return;

but that doesnt work so Im assuming that the grid value for map_marker_icon_path isnt exposed, or I need to refer to it differently if it is being derived from the data grid on the dashboard page.

I notice that the description field (in my case 'DisplayOnMap') is correctly displayed on the google map on the dashboard. If I could find out how that is referenced I could do the same with map_marker_icon_path.

As a test I set the description field to map_marker_icon_path and it is shown ciorrectly for each marker as a description, but I cant access it to use to set the icon path for each marker for some reason.

Can you suggerst where to look?

Thanks a million,

Geoff.

Sergey Kornilov admin 4/6/2026

Just wanted to say that the issue was understood and we are looking into this.