Converting ABL Code to C# Errors

When upgrading BPMs from 9.05.702a to 10.2.100.11 using the Epicor converter, https://scrs.epicor.com/ABLConversionweb/ I have received the following errors:

CS1503 - Argument 2: Cannot convert from ‘string’ to ‘SystemIFormatProvider’.
CS0165 - Use of unassigned local variable ‘UDCodes’

Here is the ABL Code:
for each ttvendor, each udcodes where udcodes.company = ttvendor.Company and udcodes.CodeTypeID = “next” and udcodes.CodeID = “supplier” exclusive-lock.
ttvendor.VendorID = string(udcodes.number02, “99999999”).
udcodes.Number02 = udcodes.Number02 + 1.
end.

Here is the converted code:
Ice.Tables.UDCodes UDCodes;
foreach (var ttVendor_xRow in ttVendor)
{
var ttVendorRow = ttVendor_xRow;
using (System.Transactions.TransactionScope txScope = IceDataContext.CreateDefaultTransactionScope())//start the transaction
{
foreach (var UDCodes_iterator in (from UDCodes_Row in Db.UDCodes
where UDCodes_Row.Company == ttVendor_xRow.Company && string.Compare(UDCodes_Row.CodeTypeID ,“next” ,true)==0&& string.Compare(UDCodes_Row.CodeID ,“supplier”
,true)==0 select UDCodes_Row))
{
UDCodes = UDCodes_iterator;
ttVendor_xRow.VendorID = System.Convert.ToString((decimal)UDCodes[“number02”], “99999999”);
UDCodes[“Number02”] = (decimal)UDCodes[“Number02”] + 1;
}
Db.UDCodes.Update(UDCodes);
txScope.Complete();//commit the transaction
}
}

Can anyone help me out resolving the errors?

try this:

    Ice.Tables.UDCodes UDCodes = null;
foreach (var ttVendor_xRow in ttVendor)
{
var ttVendorRow = ttVendor_xRow;
using (System.Transactions.TransactionScope txScope = IceDataContext.CreateDefaultTransactionScope())//start the transaction
{
foreach (var UDCodes_iterator in (from UDCodes_Row in Db.UDCodes
where UDCodes_Row.Company == ttVendor_xRow.Company && string.Compare(UDCodes_Row.CodeTypeID ,"next" ,true)==0&& string.Compare(UDCodes_Row.CodeID ,"supplier"
,true)==0 select UDCodes_Row))
{
UDCodes = UDCodes_iterator;
ttVendor_xRow.VendorID = ((decimal)UDCodes["Number02"]).ToString("N0");
UDCodes["Number02"] = (decimal)UDCodes["Number02"] + 1;
}
Db.UDCodes.Update(UDCodes);
txScope.Complete();//commit the transaction
}
}
1 Like

Thanks so much Chris, that worked!

1 Like