Free Support Forum - aspose.com

Task Custom field do not return the correct value if they are read-only

Hi,


In the attached MPP file, the Custom Field “PMC Baseline Start” (Text25) contains a formula:
IIf([Baseline Estimated Start]=projdatevalue(“NA”),"",Format([Baseline Estimated Start],“YYYY-MM-DD”))

When opened in MS Project, the correct date is displayed in format yyyy-mm-dd, however when we retrieve the value of this field with Aspose (through ExtendedAttribute.getValue() ), it will return a long Date String with hours included, such as:
10/12/2009 8:00:00 PM

After a quick look in Aspose (obfuscated) code, I found that Aspose will return a different value than the “normal” one if the ExtendedAttribute is read-only (plus another unknown criteria):

public String getValue()
{
if ((getValueReadOnly()) && (c())) {
return d();
}
return this.b; // b is where the correct value is.
}

When I use reflection to retrieve the value of the private field b , I got the correct value for the custom field, i.e. the date in format yyyy-mm-dd as displayed in MS Project.

1) Is this a bug or is there a valid reason for not returning the same value as the one visible in MS Project?

2) If there’s a good reason for this behavior, is there a supported way to retrieve the “visible” value that appears in the MS Project custom field? I’m only interested in retrieving the custom field value in the same form as what is displayed in MS Project.

Kind Regards,
Etienne.

Hi Etienne,


Thank you for writing to Aspose support team.

This is issue is re-produced and logged under Id:TASKSJAVA-269 for further investigation by the product team. You will be automatically notified once any update is received in this regard.

Thanks for the quick response, and I’m glad you confirmed this is not the intended behavior :slight_smile:

Hi,


This issue is actually much more serious than initially thought: The problem is not only with reading the wrong value from read-only Formula fields ; it will corrupt these fields when you open and save an MPP file with such fields with Aspose.
- First, all tasks will have the “wrong” value set in the field when first opening the MPP file (FYI, we disabled project calculation on open/update in MSP)
- The leaf tasks will have the correct value if you click “Calculate Project” in MSP, but the summary tasks will be irremediably broken, and “Calculate Project” in MSP will do nothing, even when the source fields used in the formula to compute the value change.

Please take that into account for TASKSJAVA-269. This is a critical issue for us.

Thanks!

Hi Etienne,


I have observed the issue of changing field value when loading and saving the MPP file using Aspose.Tasks. This issue is reported to product team under the same ticket.

I am afraid that I could not re-produce the second issue by following the steps below:
  1. Load mpp file using Aspose.Tasks
  2. Save mpp file back using Aspose.Tasks.
  3. Open the saved MPP file in MSP 2010. (Issue is there in calculated field)
  4. If we press “Calculate Project”, the calculated field becomes fine and time part is removed as expected.
  5. Now change the source field date. It changes the calculated field as well, whereas you have reported that it does not change.
Please explain the second issue in detail.

Hi,


The problem only occurs for summary tasks. Leaf tasks are fine. I’m using MSP 2016,

Hi Etienne,


I have checked your source MPP file both in MSP 2010 and MSP 2016. If we add the summary task above the two tasks, it shows NA in the summary tasks dates. Similarly if we recalculate project using MSP 2016, and also change the sub tasks date, no change is there in the summary task. It seems there is some issue in the source MPP file and not the issue of Aspose.Tasks. I have already reported the first issue reported in the previous post to the product team.

Please feel free to write us back if you have any other query related to Aspose.Tasks.

Hi Kashif,


Please check the attached zip file.

1) Test Project.mpp contains 4 tasks (2 summary tasks & 2 leaf tasks), as well as a few noticeable fields:
- Text 18 is a formula custom field based on values of fields Text7 & Text8:
IIf([Text7]<>"" Or [Text8]<>"",[Text7] & “::” & [Text8],"")
- Text25 is a formula custom field based on the value of Baseline estimated Date:
IIf([Baseline Estimated Start]=projdatevalue(“NA”),"",Format([Baseline Estimated Start],“YYYY-MM-DD”))
- Text28 is a formula custom field based on field Baseline Work:
IIf(InStr(([Baseline Work]/60),’,’)>0,Cstr(Left(([Baseline Work]/60),(InStr(([Baseline Work]/60),’,’))-1)+Chr(46)+Right(([Baseline Work]/60),(Len(([Baseline Work]/60))-InStr(([Baseline Work]/60),’,’)))),([Baseline Work]/60))

As you can see, I did input some values for all the source fields, and calculated the project, which caused the formula custom fields to be filled, except Text18 for the summary tasks (I don’t quite know why, but this is some MSP behavior I guess).
If I change the source fields and press “calculate project”, the formula custom fields are updated. That’s the expected behavior.

2) I opened and immediately saved with file with Aspose, without doing any modifications. The result is saved in file “Test Project saved with Aspose.mpp”.
The only problem here is that Text25 now contains the date with the time, i.e. not what was in the initial MPP file (YYYY-MM-DD format). I think this part will be covered by the existing issue, as reading & writing this field seems to have the same problem.

3) What I did then is edit the source fields in the file saved by Aspose (Text 7, Text 8, Baseline Estimated Start and Baseline Work) for all the tasks, and I pressed "Calculate Project).
The expected behavior is that Custom formula fields will be updated accordingly, however that only worked for Text18, and Text25 leaf tasks, not Text25 summary tasks nor Text28. This worked fine before saving the file with Aspose, and don’t work anymore after saving the file with Aspose. That’s the new issue I’m referring to. It looks like Aspose will mess up with some (and only some) custom formula fields, maybe based on the type of the fields used in the formula. I didn’t tried source fields using lookups, but it’s also something that should be tested.

All tests done with MSP 2016.

Let me know if there’s anything you cannot reproduce.

Thanks!

Hi Etienne,


All these issues are re-produced and logged under a separate ticket Id:TASKSJAVA-272 for further investigation by the product team. You will be automatically notified once any update is received in this regard.

@etiennecanaud,

The issue reported under id: TASKSJAVA-269 has been fixed in Aspose.Tasks for Java 17.11 release.

The issues you have found earlier (filed as TASKSJAVA-272) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by kashif.iqbal