PROBLEM WITH DATAPROCESSOR :INCORRECT FIELD NAME USED


#1

Hi,
I’m trying to update my db view with a dataprocessor :

<?php [...] $list = new OptionsConnector($res, "SQLSrv"); $list->render_table("CRMRISORSE","KEYRIF","KEYRIF(value),ANAGRA(label)"); $scheduler = new schedulerConnector($res, "SQLSrv"); $scheduler->enable_log("temp.log", true); $scheduler->set_options("sections", $list); if ($scheduler->is_select_mode())//code for loading data { $scheduler->render_sql("SELECT PK,INDPRE,FINDPRE,ANAGRA,RISASS,RISNOME from WWEB_TASK_CALENDAR","PK","INDPRE,FINDPRE,ANAGRA,RISASS,RISNOME,PK,KEYRIF"); } else //code for other operations - i.e. update/insert/delete { $scheduler->render_sql("SELECT PK,INDPRE,FINDPRE,ANAGRA from WWEB_TASK_CALENDAR","PK","INDPRE,FINDPRE,ANAGRA"); // } ?>

But when i save this is the result:

DataProcessor object initialized
6_1_id => 6_1
6_1_start_date => 2018-03-05 09:00
6_1_end_date => 2018-03-05 18:00
6_1_text => PROVA
6_1_RISASS => 1
6_1_RISNOME => RISORSA 1
6_1_!nativeeditor_status => updated
ids => 6_1

Row data [6_1]

Incorrect field name used: INDPRE

data

Incorrect field name used: INDPRE

data

Incorrect field name used: FINDPRE

data

Incorrect field name used: FINDPRE

data

Incorrect field name used: ANAGRA

data

Incorrect field name used: ANAGRA

data

UPDATE WWEB_TASK_CALENDAR SET INDPRE=’’,FINDPRE=’’,ANAGRA=’’ WHERE PK=‘6_1’

Edit operation finished
0 => action:updated; sid:6_1; tid:6_1;

Done in 0.095613956451416s

Why it recognizes only the PK field?
thank you


#2

you’ll need to define custom sql queries for insert/update/delete actions.
docs.dhtmlx.com/connector__php_ … lexqueries

Please try the following code:

if ($scheduler->is_select_mode()){//code for loading data {
$scheduler->render_sql(“SELECT PK,INDPRE,FINDPRE,ANAGRA,RISASS,RISNOME,KEYRIF FROM WWEB_TASK_CALENDAR”,“PK”,“INDPRE,FINDPRE,ANAGRA,RISASS,RISNOME,PK,KEYRIF”);
}else{ //code for other operations - i.e. update/insert/delete
$scheduler->sql->attach(“Update”,“UPDATE CRMTASK SET INDPRE=’{INDPRE}’, FINDPRE=’{FINDPRE}’, ANAGRA=’{ANAGRA}’ WHERE KEYRIF=’{KEYRIF}’”);
$scheduler->sql->attach(“Insert”,“INSERT INTO CRMTASK (INDPRE,FINDPRE,ANAGRA) VALUES (’{INDPRE}’, ‘{FINDPRE}’, ‘{ANAGRA}’)”);
$scheduler->sql->attach(“Delete”,“DELETE FROM CRMTASK WHERE KEYRIF=’{KEYRIF}’”);
$scheduler->render_sql(“SELECT INDPRE,FINDPRE,ANAGRA,KEYRIF FROM CRMTASK”,“KEYRIF”,“INDPRE,FINDPRE,ANAGRA”);
}