selectBaseline() is not working properly in Agile PLM
After using IProgram.selectBaseline(); method, am trying to get Project Schedule duration.
but this is not returning correct values, always returns current project duration. below is the snippet.
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import com.agile.api.APIException;
import com.agile.api.AgileSessionFactory;
import com.agile.api.IAgileSession;
import com.agile.api.IProgram;
import com.agile.api.IRow;
import com.agile.api.ITable;
import com.agile.api.ProgramConstants;
public class TestingBaselineInfo {
public static void main(String[] args) {
HashMap<Integer, String> params = new HashMap<Integer, String>();
params.put(AgileSessionFactory.USERNAME, “xxxxxxxxx”);
params.put(AgileSessionFactory.PASSWORD, “xxxx”);
params.put(AgileSessionFactory.URL, “https://xxxx.xxx.com/Agile”);
IAgileSession agileSession;
try {
agileSession = AgileSessionFactory.createSessionEx(params);
System.out.println(agileSession.getCurrentUser() + ” logged in to ” + params.get(AgileSessionFactory.URL));
IProgram objProg = (IProgram)agileSession.getObject(IProgram.OBJECT_TYPE, “PROJECT09861”);
Map map = objProg.getBaselines();
System.out.println(map.size());
Iterator iterator = map.keySet().iterator();
while (iterator.hasNext()) {
Object key = iterator.next();
String value = map.get(key).toString();
System.out.println(key + ” ” + value);
}
Set keys = map.keySet();
Object[] keysArray = keys.toArray();
for(int i=0; i<keysArray.length;i++)
{
Object baseline = keysArray[i];
System.out.println(baseline);
objProg.selectBaseline(baseline);
System.out.println(“Project Status : “+objProg.getValue(ProgramConstants.ATT_GENERAL_INFO_STATUS));
Double scheduleDuration = (Double) objProg.getValue(ProgramConstants.ATT_GENERAL_INFO_SCHEDULE_DURATION);
Double actualDuration = (Double) objProg.getValue(ProgramConstants.ATT_GENERAL_INFO_ACTUAL_DURATION);
System.out.println(“Schedule Duration : “+scheduleDuration);
System.out.println(“Actual Duration : “+actualDuration);
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
Any help would be appreciated. š
I’m not very technical, butĀ IĀ do recall seeing multiple bugsĀ on Oracle Support related to baseline dates while looking into other issues. I just checked and found thatĀ there is a limited availability patch “Projects Showing Incorrect Baseline Date” available that you might want to look into. Ā I don’t know all the details, but you might want to create an SR to get more info on this.