Subtable Query - won't accept conditions

This may well be user error but could also be a bug.
(W5 B7, PHP, MySQL)

I have a table called departments and a subtable (foreign key linked) called departmentbudget
In Database manager they show correctly linked as well as in Query Builder. The issue comes when I want a list of departments but restrict the budgets that show to a certain financial year.

This is the main query (no conditions)

Double-click the departments_budget entry and go to the sub-query’s conditions


(I have tried with a static value of 1 which I know there are records for - i.e. budgetFY equal 1)

I thought I could run the query for departments and add the nested query for the budgets with its own conditions but as soon as I do I get an error:

code: 0
file: "/var/www/html/dmxConnectLib/lib/db/SqlBuilder.php"
line: 150
message: "Cannot use object of type stdClass as array"
trace: "#0 /var/www/html/dmxConnectLib/modules/dbconnector.php(371): lib\\db\\SqlBuilder->where('budgetDep', 'in', Array)\n#1 /var/www/html/dmxConnectLib/modules/dbconnector.php(64): modules\\dbconnector->processSubQueries(Object(lib\\db\\Connection), Array, Object(stdClass))\n#2 /var/www/html/dmxConnectLib/lib/App.php(197): modules\\dbconnector->select(Object(stdClass), 'q_departments', Array)\n#3 /var/www/html/dmxConnectLib/lib/App.php(169): lib\\App->execSteps(Object(stdClass))\n#4 /var/www/html/dmxConnectLib/lib/App.php(137): lib\\App->execSteps(Array)\n#5 /var/www/html/dmxConnectLib/lib/App.php(126): lib\\App->exec(Object(stdClass), false)\n#6 /var/www/html/dmxConnectLib/lib/App.php(104): lib\\App->exec(Object(stdClass))\n#7 /var/www/html/dmxConnect/api/purchasing/departments/departments_get.php(8): lib\\App->define(Object(stdClass))\n#8 {main}"

I have to remove the subtable condition for it to work at all

I think the issue is when I have a department that doesn’t yet have a budget set but it should be able to cope with that, just returning an empty array for the subtable query for that department (like it does with no conditions)

What am I missing?

Community Page
Last updated: