Hi, I have the paid version. I am trying to make updates to one table through a joined SQL statement, but I receive error messages when I try to make cell updates.
Could you please help?
Here is my SQL query:
$g->select_command = "SELECT O.ID, O.UPC, O.STYLE, O.COLOR, O.SIZE, O.DIMENSION, O.SEASON, O.GENDER, O.CATEGORY, O.WMS_INVENTORY, O.BC_INVENTORY, O.BLANK, O.WEBSITE, O.SAMPLE, O.NEIMAN, O.NOR16, O.NOR08, O.NEI04, O.NOR24, P.DIFF, P.BLANK AS NEW_BLANK, P.WEBSITE AS NEW_WEBSITE, P.SAMPLE AS NEW_SAMPLE, P.NEIMAN AS NEW_NEIMAN, P.NOR16 AS NEW_NOR16, P.NOR08 AS NEW_NOR08, P.NEI04 AS NEW_NEI04, P.NOR24 AS NEW_NOR24 FROM INVEN.ORIGINAL_INVENTORY O LEFT JOIN INVEN.PROCESSING_INVENTORY P ON O.UPC = P.UPC";
$g->table = "INVEN.PROCESSING_INVENTORY";
These are the errors it produces…
Couldn't execute query. [unixODBC][FreeTDS][SQL Server]Invalid column name 'ID'. – UPDATE INVEN.PROCESSING_INVENTORY SET BLANK='50' WHERE ID IN ('4')
PHP Warning: Invalid argument supplied for foreach() in /var/www/mysite/lib/inc/jqgrid_dist.php on line 5524
Hello,
I'd recommend to connect on_update event handler and run your query manually.
As 2 tables are involved, it may be confusing for grid.
Thanks Abu! I read about the on_update event handler, but I'm not sure how to use it with my code.
Should I just add it like this?
$g->select_command = "SELECT O.ID, O.UPC, O.STYLE, O.COLOR, O.SIZE, O.DIMENSION, O.SEASON, O.GENDER, O.CATEGORY, O.WMS_INVENTORY, O.BC_INVENTORY, O.BLANK, O.WEBSITE, O.SAMPLE, O.NEIMAN, O.NOR16, O.NOR08, O.NEI04, O.NOR24, P.DIFF, P.BLANK AS NEW_BLANK, P.WEBSITE AS NEW_WEBSITE, P.SAMPLE AS NEW_SAMPLE, P.NEIMAN AS NEW_NEIMAN, P.NOR16 AS NEW_NOR16, P.NOR08 AS NEW_NOR08, P.NEI04 AS NEW_NEI04, P.NOR24 AS NEW_NOR24 FROM INVEN.ORIGINAL_INVENTORY O LEFT JOIN INVEN.PROCESSING_INVENTORY P ON O.UPC = P.UPC";
$g->table = "INVEN.PROCESSING_INVENTORY";
$e["on_update"] = array("update_INVEN.PROCESSING_INVENTORY", null, false);
// return last inserted id for further working
$e["on_after_update"] = array("after_update", null, true);
// invoked to filter data before displaying on grid
$e["on_data_display"] = array("filter_display", null, true);