Dears,
I'm facing an issue during projects upload job via DMF and via a customized job for upload.
the problem is the system is not generating the number sequence for project ID and the job gives error that the record already exist (which is not exist at all).
if i create the subprojects manually via the rich client with no name and dummy data and then use the DMF to update existing subprojects information it will work fine because the DMF can find the project ID in the system already.
below is the job used (as alternative ) for upload... if any one can help in this code to add something related to the number sequence creation during the job or how to modify the DMF job please.
staticvoid ImportProjects(Args _args)
{
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
COMVariantType type;
// Name name;
FileName filename;
int row =1;
int i=0;
str projTypestr;
str projStatus;
ProjType projType;
ProjTable projTable; // name of the table
Dialog dialog;
DialogField dialogField;
;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
dialog = new Dialog("FileOpen");
dialogfield = dialog.addField(extendedTypeStr(Filenameopen), "File Name");
dialog.run();
if (dialog.run())
{
filename = (dialogfield.value());
}
try
{
workbooks.open(filename);
}
catch (Exception::Error)
{
throw error("File cannot be opened.");
}
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
do
{
ttsBegin;
row++;
projTable.ISOW = cells.item(row, 1).value().bStr();
projTable.ProjId = cells.item(row, 2).value().bStr();
projTable.Name = cells.item(row, 3).value().bStr();
projTable.ProjGroupId = cells.item(row, 4).value().bStr();
projTable.ProjInvoiceProjId = cells.item(row, 5).value().bStr();
projTable.CustAccount = cells.item(row, 6).value().bStr();
projTypestr = cells.item(row, 7).value().bStr();
projtable.Type = str2Enum(projType, projTypestr);
projStatus = cells.item(row, 8).value().bStr();
projTable.ProjectedStartDate= cells.item(row,9).value().date();
//projTable.PSAProjStatus = cells.item(row, 9).value().bStr();
projTable.ParentId = cells.item(row, 10).value().bStr();
info(strFmt("%1", cells.item(row, 10).value().bStr()));
projTable.PSASchedCalendarId =cells.item(row, 11).value().bStr();
projTable.ProjCarryForwardNegativeBudget =cells.item(row, 12).value().boolean();
projtable.insert();
ttsCommit;
i++;
type = cells.item(row+1, 1).value().variantType();
}
while (type != COMVariantType::VT_EMPTY);
application.quit();
info("Done");
info(strFmt("%1", i));
}