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]