Read a Task's Timephased Data in Ruby

Aspose.Tasks - Read a Task’s Timephased Data

To read a Task’s Timephased Data using Aspose.Tasks Java for Ruby, simply invoke GetTaskTimephasedData module. Here you can see example code.

Ruby Code

 1project = Rjb::import('com.aspose.tasks.Project').new('test_tasks.mpp')
 2prj = Rjb::import('com.aspose.tasks.Prj')
 3tsk = Rjb::import('com.aspose.tasks.Tsk')
 4cal = Rjb::import('java.util.Calendar').getInstance()
 5cal.set(2013,7,17,8,0,0)
 6project.set(prj.START_DATE, cal.getTime())
 7project.set(prj.NEW_TASKS_ARE_MANUAL, Rjb::import('com.aspose.tasks.NullableBool').new(false))
 8task = project.getRootTask().getChildren().add("Task")
 9rsc = project.getResources().add("Rsc")
10rsc.set(Rjb::import('com.aspose.tasks.Rsc').STANDARD_RATE, Rjb::import('java.math.BigDecimal').valueOf(10))
11rsc.set(Rjb::import('com.aspose.tasks.Rsc').OVERTIME_RATE, Rjb::import('java.math.BigDecimal').valueOf(15))
12task.set(tsk.DURATION, project.getDuration(6))
13assignment = project.getResourceAssignments().add(task, rsc)
14d = Rjb::import('java.util.Date').new(0)
15assignment.set(Rjb::import('com.aspose.tasks.Asn').STOP, Rjb::import('java.util.Date').new(0))
16assignment.set(Rjb::import('com.aspose.tasks.Asn').RESUME, Rjb::import('java.util.Date').new(0))
17assignment.set(Rjb::import('com.aspose.tasks.Asn').WORK_CONTOUR, Rjb::import('com.aspose.tasks.WorkContourType').BackLoaded)
18project.setBaseline(Rjb::import('com.aspose.tasks.BaselineType').Baseline)
19task.set(tsk.PERCENT_COMPLETE, 50)
20td = assignment.getTimephasedData(assignment.get(Rjb::import('com.aspose.tasks.Asn').START),
21                                  assignment.get(Rjb::import('com.aspose.tasks.Asn').FINISH),
22                                  Rjb::import('com.aspose.tasks.TimephasedDataType').AssignmentRemainingWork).toList()
23puts "Size: " + td.size().to_s
24puts "Value: " + td.get(0).getValue().to_s

Download Running Code

Download Read a Task’s Timephased Data (Aspose.Tasks) from any of the below mentioned social coding sites:

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.