Import MS Project Milestones only

I would like to import an MS Project file into my SyncFusion timeline, but I only want to import milestones (0-day duration).

What do we need to do to enable an upload of only milestones (but not other tasks)? How do we filter out non-milestone activities?

If we can only import XML files, what do we need to do to import only milestones? Thank you.

Attachment: Timeline_5142021_e2e51876.zip

1 Reply 1 reply marked as answer

MS Monisha Sivanthilingam Syncfusion Team May 17, 2021 11:04 AM UTC

Hi Tim, 
 
Greetings from Syncfusion support. 
 
We can achieve your query by filtering the records with duration equal to 0 before rendering them. This way, only the milestone records will be imported to XML. We have made use of a loop to go through all the data in the data source and filter out only the records with duration 0. The following code snippets demonstrate the solution. 
 
Index.js 
 
var ganttChart = new ej.gantt.Gantt({ 
            dataSource: milestones(), 
            taskFields: { 
                id: 'TaskID', 
                name: 'TaskName', 
                startDate: 'StartDate', 
                endDate: 'EndDate', 
                duration: 'Duration', 
                progress: 'Progress', 
                dependency: 'Predecessor', 
                parentId: 'parentID', 
                baselineStartDate: 'BaselineStartDate', 
                baselineEndDate: 'BaselineEndDate', 
                notes: 'Notes' 
            }, 
 
                … 
 
        }); 
        ganttChart.appendTo('#Default'); 
 
 
 
function milestones() { 
            var milestone = []; 
            for (var i = 0; i < GanttData.length; i++) { 
                    if (GanttData[i].Duration == 0) { 
                        var task = {}; 
                        task.TaskID = GanttData[i].TaskID; 
                        task.TaskName = GanttData[i].TaskName; 
                        task.StartDate = GanttData[i].StartDate; 
                        task.Duration = GanttData[i].Duration; 
                        task.Progress = GanttData[i].Progress; 
 
                        milestone.push(task); 
                    } 
                } 
            return milestone; 
        } 
 
 
Note: The work-around we have shared works only for self-referential data and not for Hierarchical data. 
 
Please contact us if you require any further assistance. 
 
Regards, 
Monisha. 


Marked as answer
Loader.
Up arrow icon