Can not change the information register data

Understanding basics of 1C:Enterprise platform. To start working with 1C:Enterprise platform visit Getting started page

#1
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Oct 8, 2012
Company: Mal Ratu Indah

Salam!

I am trying to update some attributes in the information register while others should stay unchanged. I use the RecordSet for that, but somewhy the previous data is deleted when I write the RecordSet. Here is what I do:

Code
   RecordSet = InformationRegisters.ItemData.CreateRecordSet();
   RecordSet.Filter.Item.Set(CurrentItem);
   For Each Record In RecordSet Do
      Record.ModifiedAt = CurrentDate();
      Record.ModifiedBy = Ref;
   EndDo;
   RecordSet.Write();

 
#2
People who like this:0Yes/0No
Active user
Rating: 7
Joined: Sep 26, 2012
Company: individual

You need read records after filter on recordset sets
change to:

Code
RecordSet = InformationRegisters.ItemData.CreateRecordSet();
RecordSet.Filter.Item.Set(CurrentItem);
RecordSet.Read();
For Each Record In RecordSet Do
   Record.ModifiedAt = CurrentDate();
   Record.ModifiedBy = Ref;
EndDo;
RecordSet.Write();


Why so?
When write recordset without reading before, the empty recordset will be writing with filtering. Its like remove records with some filter.

Edited: ivan avdonin - Dec 03, 2012 03:43 PM
 
#3
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Oct 8, 2012
Company: Mal Ratu Indah

Understood, thank you!

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.