Desktop version

Main > Forum > 1C:Enterprise Platform > Studying 1C:Enterprise platform > Can not change the information register data

Forum

Search UsersRules
Can not change the information register data
#1
Just came
Points:: 0
Joined:: Oct 8, 2012

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();

Profile
#2
Active user
Points:: 0
Joined:: Sep 26, 2012

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.

Profile
#3
Just came
Points:: 0
Joined:: Oct 8, 2012

Understood, thank you!

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.