Error while setting TimeScaleDataValue

J

Joe Cletcher

Any idea on what is causing the error message? Is the collection of
"TimeScaleDataValues" missing items above year 2013?

I am trying to assign values to a task resource's "TimeScaleData" using the
following VisualBasic .Net statement.

MyProjTaskAssignment.TimeScaleData(BeginDate, EndDate, _
PjAssignmentTimescaledData.pjAssignmentTimescaledWork, _
PjTimescaleUnit.pjTimescaleYears, 1).Item(1).Value = MyValue


The above statement works fine for
BeginDate=1/1/2005,1/1/2006, thru 1/1/2012
EndDate =1/1/2006,1/1/2007, thru 1/1/2013 (ie-1 year more than BeginDate)
MyValue = 1 or 3 times (60*1836)

but erases previous values as soon as you assign a value for a BeginDate of
1/1/2013 and then generates an error message when trying to assign a value
for a BeginDate of 1/1/2014.

====Error Message States==========
An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in WbsScheduler.exe

Additional information: The argument value is not valid.
====End of Error Message==========



==========SAMPLE CODE==============
For Each MyProjTaskAssignment In aTask.Assignments
aRow = GetTaskRow(myProj, aTask) + k
For j = 0 To dbAct.CostElements.Count - 1
dbCE = dbAct.CostElements.Item(j)
BeginDate = DtStr & CStr(dbCE.Year)
EndDate = DtStr & CStr(dbCE.Year + 1)
If MyProjTaskAssignment.ResourceName = "FTE" Then
MyValue = dbCE.FTE * 60 * ProgCon.FTEAnnualHours
Else
MyValue = dbCE.Cost
End If
aDateStr = BeginDate.ToShortDateString
myProjApp.SelectTimescaleRange(aRow, aDateStr, 1, 1)

MyProjTaskAssignment.TimeScaleData(BeginDate, EndDate, _
PjAssignmentTimescaledData.pjAssignmentTimescaledWork, _
PjTimescaleUnit.pjTimescaleYears, 1).Item(1).Value = MyValue
Next j
k = k + 1
Next MyProjTaskAssignment
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top