Dear All I have wrtitten this code to update multiple customer for multiple addresses by importing EXcel file into this code execution. when we will open a particular customer details this code will assign same purpose for a every customer but how can i change this code to update different - different purpose for a single customer and multiple customer. ------------------------------------------------*----------------------------------------------------- static
void
updateCustomerMultipleNewAddress(Args _args) { CommaIO csvFile; LogisticsLocationRole logisticsLocationRole; DirPartyLocationRole partyLocationRole; DirPartyLocation location;
container
readCon; counter icount,inserted; Dialog dialog; DialogField dfFileName; DirPartyRecId partyRecId; Name name; DirPartyView dirpartyview; CustAccount custAccount; CustTable custtable; FileName fileName; DirPartyPostalAddressView addressView; DirParty dirParty; DirPartyTable dirPartyTable; LogisticsPostalAddress address; DirPartyAddressLocationRoleNames names; inserted =
0
; #File dialog =
new Dialog("Pick the file"
); dfFileName = dialog.addField(
extendedTypeStr
(FileNameOpen)); dialog.filenameLookupFilter([
"All files"
, #AllFiles]);
if
(dialog.run()) { filename = dfFileName.value(); } csvFile =
new CommaIO(filename, 'r'
);
if
(csvFile) { readCon = csvFile.read();
ttsbegin
;
while
(csvFile.status() == IO_Status::OK) { readCon = csvFile.read(); icount++;
if
(readCon) { name =
strUpr(conPeek(readCon,2
)); custAccount =
conPeek(readCon,1
); custtable = CustTable::find(custAccount);
// Important logic partyRecId = custtable.Party; dirPartyTable = DirPartyTable::findRec(partyRecId ,
true
);
select join partyLocationRole where location.RecId == partyLocationRole.PartyLocation join logisticsLocationRole where partyLocationRole.LocationRole == logisticsLocationRole.RecId; address.CountryRegionId =
strUpr(strLRTrim(conPeek(readCon,3
))); addressView.State =
strUpr(strLRTrim(conPeek(readCon,5
))); address.ZipCode =
strUpr(strLRTrim(conPeek(readCon,4
))); address.Street = strLRTrim(
conPeek(readCon,7
)); address.State = strLRTrim(
conPeek(readCon,5
)); address.City =
strUpr(strLRTrim(conPeek(readCon,6
))); addressView.LocationName = name; addressView.IsPrimary = NoYes::Yes; addressView.Party = partyRecId; addressview.initFromPostalAddress(address); DirParty = DirParty::constructFromPartyRecId(addressView.Party ); DirParty.createOrUpdatePostalAddress(addressView); } inserted++; } }
ttsCommit
; info(
strfmt("%1 records inserted out of %2"
,inserted,icount));
}
Please reply it as soon as possible...
Thanks
Atul Jain