Gantt:addLinks, scheduler

Hola, tengo un problema al añadir links hacia los capítulos (projects) no toma la fecha con el tipo de restricción FC, solo funciona con tareas (task), luego de accionar el scheduler, no toma la restricción ni el link (project).

¿Afecta en algo que el link se haga con una tarea (capitulo) tipo project ?

Hello Alexander,
Please ask the questions on the forum only in English so that everyone can understand it.

Project tasks ignore the date parameters you set to them (start_date, end_date, and duration). Instead, they depend on the dates of their children.
If you set the constraint date and type to a project task, these properties are ignored as its child tasks didn’t change. And when you drag a project task, you are actually dragging its child tasks, and the project task only follows them.

You can enable the auto_scheduling_project_constraint config:
https://docs.dhtmlx.com/gantt/api__gantt_auto_scheduling_project_constraint_config.html
Then, if you add a constraint to the project task, Gantt will set the same constraint to the child tasks.
You can check how it works in the following snippet:
https://snippet.dhtmlx.com/3wqu6rpk

Otherwise, you will need to implement a custom solution. You will need to manually update the dates and constraints of the child tasks. If you want to set a SNET constraint, you will need to iterate the child tasks and implement a logic that will choose the earliest task (or a task by a different criteria) and modify its constraint date. If other tasks remain on the date that violates the constraint, you will also need to implement the logic to modify the constraints of other tasks.

Hello, maybe I didn’t know how to explain myself well.

My construction project involves numerous links, with some classified as ‘task’ type and others as ‘project’ type. Unfortunately, we have noticed a significant problem with items of type ‘task’ that are linked to items of type ‘project’ using the ‘finish_to_start’ relationship. Specifically, the projected date for the ‘task’ does not align with the expected end date of the predecessor ‘project,’ resulting in incorrect scheduling.

To illustrate the issue more effectively, I have attached an example that demonstrates the incorrect behavior. You will observe that when a ‘task’ is linked to a ‘project’ with a ‘finish_to_start’ relationship, the predecessor date of the ‘task’ is not in sync with the actual end date of the predecessor ‘project.’

Curiously, we have found that by converting the predecessor ‘project’ item to a ‘task’ type, the issue is resolved, and the ‘finish_to_start’ link functions correctly.

Given the urgency of this matter, I kindly request your immediate attention and expertise in helping us rectify this problem. If there are any additional details or information required from my end, please let me know, and I will provide them promptly.

Thank you in advance for your support and understanding. I eagerly await your prompt response.


ETAPA 1 PISCINA NIÑOS - type = project


ETAPA 1 PISCINA NIÑOS - type = task

Hello Alexander,
Basing on the provided information, I suppose that you don’t know about the constraint logic that Gantt uses by default to auto-schedule tasks:
https://docs.dhtmlx.com/gantt/desktop__auto_scheduling.html#timeconstraintsfortasks

For example, if a task has a SNET constraint, it doesn’t start earlier that date. When you drag a task in the timeline, Gantt assigns that type of the constraint. It doesn’t work the same way for project tasks as these tasks depend on the dates of their child tasks, so the constraints don’t have any effect.

The issue here is that Gantt doesn’t display constraints, so it looks as if something doesn’t work.
Here is the video that demonstrates how it works:
https://files.dhtmlx.com/30d/d0973414931af0597635834ec2b9b3df/vokoscreen-2023-06-19_17-50-25.mp4

You can check how it works in the following snippet:
https://snippet.dhtmlx.com/yic0ng9b

In the future, the dev team will add a feature to display constraints in that scheduling mode by default.

If you want to make Gantt schedule tasks in a different way, you can enable the simpler scheduling mode:
https://docs.dhtmlx.com/gantt/desktop__auto_scheduling.html#versioncompatibility

You can check how it works in the following snippet:
https://snippet.dhtmlx.com/w6ndztcu

If that doesn’t help you, probably, the issue is related to the Gantt configuration, but it is hard to suggest what might be wrong as I don’t see your code.

In that case, please add your configuration to the following snippet and make sure that the issue is reproduced there:

Then, click on the Save button and send me the link.
Or send me a ready demo with all the necessary JavaScript and CSS files so that I can reproduce the issue locally.

Hello, I was able to emulate the problem, we realized that the solution of assigning a “snet” type constraint to tasks that already have progress works correctly, but the constraint for tasks whose predecessor is end start does not work (in this case it gives priority to the type of link on the snet restriction), we need that the tasks that already have progress do not change the start date.

Another thing that we realized is that if we disable the task in the onBeforeTaskAutoSchedule event under the condition of progress > 0 it will not update its successors and the date will not be the real one.

I would think that with the “snet” constraint it would work but as we mentioned it gives priority to links over the snet type constraint.

Here we do not have the condition of progress:

Here we have the condition progress > 0:

https://snippet.dhtmlx.com/easnp4hi

Hello Alexander,
Thank you for sending the snippet.
When you use the auto_scheduling_use_progress config, Gantt excludes tasks from the auto-scheduling if their progress is 100%.
However, it seems that you also use the onBeforeTaskAutoSchedule event handler, and there you disable auto-scheduling for all tasks with the progress 0.01%-100%. It seems that these conditions enable auto-scheduling for the tasks with the 100% progress, so they are auto-scheduled.
If you disable the auto_scheduling_use_progress config, they are not auto-scheduled.

Also, some of your links have the lag parameter. That means that some tasks may start earlier or later than their predecessors.

I checked the ALISTAMIENTO TORRE 1 task. When you apply auto-scheduling, it starts 2023-07-21 because of the T1 DETALLADAyTERMINACION task. The latter task is a project task and depends on the dates of its children: T1 DETALLADA ENTREGA APTOS and T1 DETALLADA ENTREGA PUNTO FIJO. The first task is linked to the T1 2DO ASEO APTOS task. Also, the link has the lag parameter, which is 40 hours. By using the calculateEndDate method, we get 19 July which is closer to the start_date of the T1 DETALLADA ENTREGA APTOS task. But as there are different calendars, the date should be calculated correctly (I didn’t check that).
Here is the updated snippet where I commented the grid configuration and added the functions for obtaining the link data:
https://snippet.dhtmlx.com/gt2rmivq

Unfortunately, the screenshots have a poor quality, so it is not clear which tasks and dates you expect.
You can tell me which tasks have the wrong dates and which dates you expect to see. Then I will check if there is something wrong with Gantt or it is working as expected.

Hello Alexander,
The dev team added the feature to display Constraints in Gantt in you use the constraint scheduling mode:
https://docs.dhtmlx.com/gantt/desktop__inbuilt_baselines.html#taskconstraints

https://docs.dhtmlx.com/gantt/whatsnew.html#x8318x90x8319x

You can see how it works in the following samples:
https://docs.dhtmlx.com/gantt/samples/02_extensions/19_constraints_scheduling.html

https://docs.dhtmlx.com/gantt/samples/02_extensions/20_backwards_scheduling.html

https://snippet.dhtmlx.com/j9dli98b