Use End_Date with gantt connector

I want to use an end_date field instead of a duration field from mysql db using connector. I understand you can use end_date in xml data by not providing a duration. How can you do the same in a render_sql statement?

The same approach, you can use any SQL code, what is matter - third parameter of th command, the list of fields.

$gantt->render_sql($sql, "id", "start_date,end_date,text,progress,parent");

The list of fields must contain end_date in place of duration

Yes I tried that but it did not work as my end_date field is not called end_date. I need to use the field named EstCompDate as my end_date.
I tried $gantt->render_sql($sql, “id”, “start_date,EstCompDate,text,progress,parent”); but it will not work with that. It seems to require the field to be named end_date specifically.

So I added the following render_sql(“Select *, EstCompDate as end_date from task”, “id”, “start_date,end_date,text,progress,parent”);
This worked for loading the data however does not save the EstCompDate.

So is there a way to specify the end_date to another field name. It is interesting to note that changing start_date to a different field name does work fine.

Try to use

$gantt->render_sql("Select *, EstCompDate as end_date from task", "id", "start_date,EstCompDate (end_date),text,progress,parent");

In next updates we will look how to simplify such scenario

This does not work. When I change the task on the gantt chart EstCompDate now gets set to 0000-00-00.

Please update gantt_connector.php with the attached one.
With it next two ways for use custom field names will work for sure

$gantt->render_sql("select *, EstCompDate as end_date from gantt_tasks_enddate","id","start_date,EstCompDate(end_date),text,progress,parent","");

or

$gantt->render_table("gantt_tasks_enddate","id","start_date,EstCompDate (end_date),text,progress,parent","");

gantt_connector.names2.zip (2.5 KB)

No this does NOT work. It has corrected the end_date. However I am also using different field names for start_date and text. Now end_date is saved correctly but start_date and text are now blank after the save. Previously they worked fine with the actual field names.

So I figured I need to use the same format for those fields. So I wrote
$gantt->render_sql(“Select *,SchedDate as start_date, EstCompDate as end_date, Name as text from task”,“ID”,“SchedDate(start_date),EstCompDate(end_date),Name(text),progress,sortorder,parent,Priority,ID,Assignto”);

But still no go. EstCompDate saves correctly but SchedDate and Name save as “Blank”

My mistake. It does work using the last scenario where I specify each field name. I had mistakenly copied to the wrong location during my test.

Thanks

The load and save with this new connector are now working. However dependency links are not. I now get the following error pop up when creating or deleting dependencies:

Error type: LoadXML
Desciption: Incorrect XML

Hello, I did not get a reply to my last email where I am getting a LoadXML error when creating dependencies. Is there a fix for this?

Please try to enable the server side logging and post here the log output

docs.dhtmlx.com/doku.php?id=dhtm … tor:errors

Here is the log below. The log of where I added a dependency connector between 2 tasks is at 9:49:45. It is blank. I get the “error type: LoadXML” at this 9:49:45 log.

====================================
Log started, 23/10/2013 09:49:24

SELECT *, SchedDate as start_date, ProjectionDate as end_date, Name as text FROM workorder WHERE ( Reference=‘R100791’ and SchedDate!=‘0000-00-00%’ and ProjectionDate!=‘0000-00-00%’ and Project=‘0’)

SELECT ID,source,target,type FROM work_depend

Done in 0.0023329257965088s

====================================
Log started, 23/10/2013 09:49:30

DataProcessor object initialized
101112_id => 101112
101112_start_date => 2013-10-20 01:00:00
101112_end_date => 2013-10-27 01:00:00
101112_text => Dupe Original 2
101112_progress => 0
101112_sortorder => 0
101112_parent => 0
101112_Priority => 1
101112_Assignto => Bob Peterson
101112_duration => 7
101112_!nativeeditor_status => updated
ids => 101112

Row data [101112]
TID => 101112
start_date => 2013-10-20 01:00:00
end_date => 2013-10-27 01:00:00
text => Dupe Original 2
progress => 0
sortorder => 0
parent => 0
Priority => 1
Assignto => Bob Peterson
duration => 7
!nativeeditor_status => updated

UPDATE workorder SET SchedDate=‘2013-10-20 01:00:00’,ProjectionDate=‘2013-10-27 01:00:00’,Name=‘Dupe Original 2’,progress=‘0’,sortorder=‘0’,parent=‘0’,Priority=‘1’,Assignto=‘Bob Peterson’ WHERE TID=‘101112’ AND (( Reference=‘R100791’ and SchedDate!=‘0000-00-00%’ and ProjectionDate!=‘0000-00-00%’ and Project=‘0’))

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

Done in 0.0010981559753418s

====================================
Log started, 23/10/2013 09:49:33

DataProcessor object initialized
101112_id => 101112
101112_start_date => 2013-10-23 01:00:00
101112_end_date => 2013-10-27 01:00:00
101112_text => Dupe Original 2
101112_progress => 0
101112_sortorder => 0
101112_parent => 0
101112_Priority => 1
101112_Assignto => Bob Peterson
101112_duration => 4
101112_!nativeeditor_status => updated
ids => 101112

Row data [101112]
TID => 101112
start_date => 2013-10-23 01:00:00
end_date => 2013-10-27 01:00:00
text => Dupe Original 2
progress => 0
sortorder => 0
parent => 0
Priority => 1
Assignto => Bob Peterson
duration => 4
!nativeeditor_status => updated

UPDATE workorder SET SchedDate=‘2013-10-23 01:00:00’,ProjectionDate=‘2013-10-27 01:00:00’,Name=‘Dupe Original 2’,progress=‘0’,sortorder=‘0’,parent=‘0’,Priority=‘1’,Assignto=‘Bob Peterson’ WHERE TID=‘101112’ AND (( Reference=‘R100791’ and SchedDate!=‘0000-00-00%’ and ProjectionDate!=‘0000-00-00%’ and Project=‘0’))

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

Done in 0.001039981842041s

====================================
Log started, 23/10/2013 09:49:45

====================================
Log started, 23/10/2013 09:50:45

DataProcessor object initialized
101112_id => 101112
101112_start_date => 2013-10-24 01:00:00
101112_end_date => 2013-10-28 01:00:00
101112_text => Dupe Original 2
101112_progress => 0
101112_sortorder => 0
101112_parent => 0
101112_Priority => 1
101112_Assignto => Bob Peterson
101112_duration => 4
101112_!nativeeditor_status => updated
ids => 101112

Row data [101112]
TID => 101112
start_date => 2013-10-24 01:00:00
end_date => 2013-10-28 01:00:00
text => Dupe Original 2
progress => 0
sortorder => 0
parent => 0
Priority => 1
Assignto => Bob Peterson
duration => 4
!nativeeditor_status => updated

UPDATE workorder SET SchedDate=‘2013-10-24 01:00:00’,ProjectionDate=‘2013-10-28 01:00:00’,Name=‘Dupe Original 2’,progress=‘0’,sortorder=‘0’,parent=‘0’,Priority=‘1’,Assignto=‘Bob Peterson’ WHERE TID=‘101112’ AND (( Reference=‘R100791’ and SchedDate!=‘0000-00-00%’ and ProjectionDate!=‘0000-00-00%’ and Project=‘0’))

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

Done in 0.0010819435119629s