I have roughly 16,000 customers inserting into DAX with the incorrect partyType. I want to change customers with type person to organization and thanks to Andre from Kaya I have this job that will change one record.
static void changeCustomerPartyAssociation(Args _args)
{
DirPartyEntityAssociationUpdate entityAssociation;
DirPartyMap entityRecord;
DirPartyTable firstParty, associatedParty;
CustTable custTable;
CustAccount custAccount;
custAccount = "00000641";
custTable = custTable::find(custAccount, true);
entityRecord = custTable;
entityAssociation = new DirPartyEntityAssociationUpdate();
entityAssociation.setEntityRecord(entityRecord);
// setting original party
firstParty = DirPartyTable::findRec(entityAssociation.getParty());
// creating new party (type Organization)
associatedParty = DirPartyTable::createNew(DirPartyType::Organization, custTable.name());
// setting new party
entityAssociation.setNewParty(associatedParty.RecId);
entityAssociation.run();
}
This works, but I'd like to read a CSV of accounts that need changing and run this code for each of the 16,000. I think that the code below somehow applied to the code above could work, but I'm still somewhat new to x++ and am not sure how to meld the two jobs together.
static void TestCommaTextIO(Args _args)
{
#File
CommaTextIo commaTextIo;
FileIOPermission permission;
container containFromRead;
int x;
int cols;
;
permission = new FileIOPermission('c:\\junk\\mycsv.csv',#io_read);
permission.assert();
commaTextIo = new CommaTextIO('c:\\junk\\mycsv.csv','R');
containFromRead = commaTextIo.read();
While(containFromRead)
{
cols = conLen(containFromRead);
for(x=1;x<=cols;x++)
{
print conpeek(containFromRead,x);
}
containFromRead = commaTextIo.read();
}
pause;
commaTextIo = null;
}
Any help would be appreciated