I am trying to update ABL code to C#. This particular BPM is part of a customization for “training”. I was able to work out the beginning code - however I am stuck at the part where I would like to create a new record and store data in the new record.
Here is what I have at this point:
string sModule=string.Empty;
string sCompanyID=string.Empty;
string sRoleID=string.Empty;
string sRowMod=string.Empty;
DateTime? dAdded=null;
Ice.Tables.UD103A UD103A;
Ice.Tables.UD08 UD08;
foreach(var ttUD100A_xRow in ttUD100A)
{
if(ttUD100A_xRow != null)
{
var ttUD100ARow=ttUD100A_xRow;
sRoleID = ttUD100ARow.Key1;
sModule = ttUD100ARow.ChildKey1;
dAdded = ttUD100ARow.Date01;
sRowMod = ttUD100ARow.RowMod;
sCompanyID = ttUD100ARow.Company;
switch(sRowMod)
{
case "U":
foreach(var UD103A_xRow in Db.UD103A.Where(a => a.Company == sCompanyID && a.ChildKey1 == sRoleID))
{
var UD103ARow = UD103A_xRow;
foreach(var UD08_xRow in Db.UD08.Where(b => b.Company == sCompanyID && b.Key1 == UD103ARow.Key1 && b.Key3 == UD103ARow.ChildKey1 && b.Key2 == sModule))
{
var UD08Row = UD08_xRow;
UD08Row["Checkbox01"] = UD103ARow["Checkbox01"];
UD08Row["Checkbox02"] = UD103ARow["Checkbox02"];
UD08Row["Checkbox03"] = UD103ARow["Checkbox03"];
}
}
break;
case "A":
foreach(var UD103A_xRow in Db.UD103A.Where(a => a.Company == sCompanyID && a.ChildKey1 == sRoleID))
{
var UD103ARow = UD103A_xRow;
foreach(var UD08_xRow in Db.UD08.Where(b => b.Company == sCompanyID && b.Key1 == UD103ARow.Key1 && b.Key3 == UD103ARow.ChildKey1 && b.Key2 == sModule))
{
var UD08Row = UD08_xRow;
UD08Row["Checkbox01"] = UD103ARow["Checkbox01"];
UD08Row["Checkbox02"] = UD103ARow["Checkbox02"];
UD08Row["Checkbox03"] = UD103ARow["Checkbox03"];
}
//I would like to add a new UD08 record here. The following is the ABL Code I am trying to convert.
// create UD08.
//assign UD08.Company = sCompanyID.
//assign UD08.Key1 = UD103A.Key1.
//assign UD08.Key2 = sModule.
//assign UD08.Key3 = sRoleID.
//assign UD08.Key4 = "".
//assign UD08.Key5 = "".
//assign UD08.Date01 = dAdded.
//assign UD08.CheckBox01 = UD103A.Checkbox01.
//assign UD08.CheckBox02 = UD103A.Checkbox02.
//assign UD08.CheckBox03 = UD103A.Checkbox03.
}
break;
} //switch(sRowMod)
} //if(ttUD100A != null)
}
I need to create a new UD08 record and I’m struggling trying to find examples.
Thanks,
DaveO