Inconsistency in date fields data

SubmitASPOSE.zip (346.8 KB)

I am reading ASPOSE.Task and I see in MSproject NA, N/A or empty column for DateTime field.
Is it possible to figure out using ASPOSE.Task how to separate these three column is NA, N/A or empty column.

When I read my project file I got some column either null or mindate (‘0001-01-01 00:00:00.0000000’)

I am not sure what i need to do, so I get exact result what I see in MSProject file.

@gshah,

Thank you for writing to Aspose support team.

For normal fields like Date (i.e Request Entered) you may please check first if it has minimum value or not. If it has minimum value, it shall be declared as empty. Otherwise get the StartText of the task. If it is null, then it is normal date field and if it is not null, then some text is writeen in the date field like N/A.

var path = @"Annual MS Project Tracking - 2018.mpp";
Project proj = new Project(path);

var task = proj.RootTask.Children.GetById(1);//Check it with 608 (N/A), 610 (Empty), 1 (Normal Date)
Console.WriteLine(task.Get(Tsk.Start));
string Text;
if (task.Get(Tsk.Start) == DateTime.MinValue)
{
    Console.WriteLine("Request Entered = Empty");
}
else
{
    Text = task.Get(Tsk.StartText);
    if (Text == null)
    {
        Console.WriteLine("Its normal date {0}", task.Get(Tsk.Start));
    }
    else
    {
        Console.WriteLine("Request Entered = {0}", task.Get(Tsk.StartText));
    }
}

For extended attributes like Date2 (Issued Date) you need to check first if the current task contains this extended attribute or not. If it does not contain this extended attribute, then it is NA. Otherwise if it contains this attribute, then get the extended attribute value from it.

var task2 = proj.RootTask.Children.GetById(609);// Check it with 608(NA) and 609(10/5/17 08:00:00)
var IssuedDate = (from data in task2.ExtendedAttributes
                where data.AttributeDefinition.Alias == "Issued Date"
                select data.Value).ToList();

if(IssuedDate.Count() > 0)
{
    //It contains this attribute. Value can be extracted
    Console.WriteLine("Task Issued date = {0}", IssuedDate[0]);
}
else
{
    //It does not contain thi attribute. It is NA
    Console.WriteLine("Task Issued date = NA");
}

Thank you - Works for me …

@gshah,

You are welcome.

I have one column Extended attribute with name Attorney date and has NA but When I try to get this value, I get ‘0001-01-01 00:00:00.0000000’.

All other column Extended attribute with date not give me any value which one has NA.

How do I resolved date column give same value, not ‘0001-01-01 00:00:00.0000000’.

Please give me direction what I should do.

Thank you,
Girish

@gshah,

I have analyzed this issue and observed the problem. This issue is logged under Id:TASKSNET-2364 for detailed analysis. We will write back here once the issue is identified and feedback is ready to share.

Hello! The issue TASKSNET-2364 has been fixed in Aspose.Tasks for .NET 18.6.