If the IcingaKey field contains spaces like "Monitoring Key" this causes problems with the query since $keyField not in quotes. Solution: Add single quotes arroud the $keyField variable. Best Regards Nicolas