Hi,
Iam having this error whenever i insert a record in my form …"Cannot edit a record in table.The record has never been selected." what is this mean i already synchronized my table twice…plz help
with regards,
harivalla
Hi,
Iam having this error whenever i insert a record in my form …"Cannot edit a record in table.The record has never been selected." what is this mean i already synchronized my table twice…plz help
with regards,
harivalla
It can cause when you try to update a record without selecting the record forupdate…
Hi kranthi,
Iam not updating any records in my form…im just inserting them…
harivalla
Hi,
Are you trying to insert data into a new record or trying to edit a new record?
Thanks and Regards,
Kevin
Sory, Or you trying to edit the already existing record? or you are trying to insert data in a new record
The insert might doing an update, try to debug the code by adding a breakpoint in the insert method…
Hi Hari
After Using the Select Statement ,check for the existence of the Record.Insert Only If it Exists.This will Resolve Your Issuse
Eg:Select Table1;
if(Table1.RecId)
{
Here Write Your Insert Code
}
Regards
Chinna
Hi kranthi,
I debugged my code and i found that some code is updating while inserting.
thx guys
try
//changeCompany (_EMPContract.Company())
{
ttsBegin;
//hcmWorker =HcmWorker::find(HcmWorkerTransition::newCreateHcmWorker(_EMPContract.PersonnelNumber(),true));
hcmWorker = HcmWorker::findByPersonnelNumber(_EMPContract.PersonnelNumber(),true);
if(!hcmWorker.RecId) //If PersonnelNumber is not existing the initialize
{
//hcmWorker.initValue();
hcmWorker.PersonnelNumber = _EMPContract.PersonnelNumber();
}
dirParty = DirParty::constructFromCommon(hcmWorker);
if(!hcmWorker.RecId)
{
//hcmworker.isintegration = noyes::yes;
dirpartytable = dirpartytable::createnew(_empcontract.partytype(),_empcontract.name());
dirpartytable.name = _empcontract.name();
dirpartytable.namealias = _empcontract.name();
// dirpartytable.update();
hcmWorker.insert();
}
else // For Updating existing
{
hcmWorker.update();
if(hcmWorker.RecId)
{
dirPartyTable = DirPartyTable::findRec(hcmWorker.RecId,true,_EMPContract.PartyType());
// for Updating person Name id the party type is person.
if(dirPartyTable.RecId && _EMPContract.PartyType() == DirPartyType::Organization)
{
dirPartyTable.Name = _EMPContract.Name();
dirPartyTable.NameAlias = _EMPContract.Name();
dirPerson.update();
}
// For Updating Person Name if the Party Type is Person.
else if (dirPartyTable.RecId && _EMPContract.PartyType() == DirPartyType::Person)
{
dirPerson = DirPerson::find(dirPartyTable.RecId,true);
dirPerson.Name = _EMPContract.Name();
dirPerson.NameAlias = _EMPContract.Name();
dirPerson.update();
//Update Person Name individually
dirPersonName.clear();
dirPersonName = DirPersonName::find(dirPerson.RecId,true);
[dirPersonName.FirstName, dirPersonName.MiddleName, dirPersonName.LastName] = DirPerson::splitNameParts(_EMPContract.Name());
dirPersonName.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
dirPersonName.ValidFrom = DirUtility::getCurrentDateTime();
dirPersonName.ValidTo = DateTimeUtil::maxValue();
if (dirPersonName.validateWrite())
{
dirPersonName.update();
}
}
}
else
{
hcmWorker.RecId = DirPartyTable::createNew(_EMPContract.PartyType(), _EMPContract.Name()).RecId;
}
}
please help me anyone this code
Thanks.
Hi, can you please create a new post and update it with proper description of the issue?
[deleted]
insert and update with is method doing