The 1C:Enterprise developers forum

#1
People who like this: 0 Yes / 0 No
Active user
Rating: 2
Joined: Jul 3, 2013
Company: TRIAX

I'm using 1C verison 8.2.315 to develop an Ordinary application with SQL Server 2008R2 DB
I got a trouble: Some records in a Accounting Registers losing
references to recorder
I try tool "Verify and Repair" in Infobase Designer, with "Verifications and modes" I chose all except the first one, with "When refrences to nonexistent objects are found" I chose "Delete Refrences" and with "If Object Data is Partially Lost" I chose "Delete object". But when Execute I get an error:
"Thử chèn giá trị không đơn trị vào chỉ số đơn trị:
Microsoft OLE DB Provider: Cannot insert duplicate key row in object 'dbo._AccRg723' with unique index '_AccRg723_ByPeriod_TRN'.
HRESULT=80040E2F,SQLSrvr: SQLSTATE=23000, sate=1, Severity=E, native=2061  line=1"
Note: I usually get this error losing reference to recorder in AccountingRegisters and Accumulation Register when I uses Exchange plans to synchronization data.
Please show me another way to remove these records or may you recover the above error?

Thanks alot!

 
#2
People who like this: 0 Yes / 0 No
Just came
Rating: 1
Joined: Oct 8, 2013
Company:

first: You need to register in exchange plans references of registrator.
second: I don't recomend you using "Verifications and modes" - only if you make backups your databases
third: i think you have problem with hard disk where placed you MS SQL database, check it

 
#3
People who like this: 0 Yes / 0 No
Active user
Rating: 2
Joined: Jul 3, 2013
Company: TRIAX

Thanks for reply!
-The first "first: You need to register in exchange plans references of registrator."
I was register in exchange plans references of registrator with Contents include Accounting registers, Accumulation Register and Catalogs, Documents posted to it (recorder). And every time I have successfully synchronized data; However some times, I got trouble: Some records in Accounting Registers and Accumulation Register losing references to recorder.
-The second "second: I don't recomend you using "Verifications and modes" - only if you make backups your databases". Because I don't know another way to remove or delete records losing references to recorder in Accounting Registers and Accumulation Register than to use "Verify and Repair Infobase" of Administration tool in Designer to these records and Recalculating totals infobase tables :(
-Third: I just check my hard disk, it is no problem.

Do you show me another way to remove records in Accounting Registers losing references to recorder and Recalculating totals. :cry:

 
#4
People who like this: 0 Yes / 0 No
Just came
Rating: 1
Joined: Oct 8, 2013
Company:

Why do you want delete these records?
Them should not be in register. Do you transfer documents for accounting register?

If you still want delete these records you can use following code:

Code
Query1 = New Query;
Query1.Text =
"SELECT
|   AccumulationRegister1.Recorder
|FROM
|   AccumulationRegister.AccumulationRegister1 AS AccumulationRegister1
|WHERE
|   AccumulationRegister1.Recorder.Number IS NULL ";
Res = Query1.Execute();
If Not Res.IsEmpty() Then 
   Return;
EndIf;

Selector = Res.Select();

While Selector.Next() Do
   
   RecordSet = AccumulationRegisters.AccumulationRegister1.CreateRecordSet();
   RecordSet.Filter.Recorder.Set(Selector.Recorder);
   RecordSet.Write();
   
EndDo;

 
#5
People who like this: 0 Yes / 0 No
Active user
Rating: 2
Joined: Jul 3, 2013
Company: TRIAX

Thanks Oleg Kravchuk for reply!
First:I want delete these records because these recorders (Documents posted to Register) has been delete but records in Register losing references to recorder still existent; And if uses query with BalanceAndTurnovers from Register then result return is wrong. So I need delete these records to recalculating totals of Register.

Then I want to cover the trouble "Some records in Accounting,Accumulation Registers losing references to recorder": My customer have Financial department in Head office, Sales and Inventory manager department in branch office; I uses and configure exchange plans to auto synchronization data between two Nodes.
And I noticed: The first when method ExchangePlans.WriteChanges() at the MasterNode, all documents just posted will be auto blocked by system, if at this the moment user opening the document and click undo posting whiles system sent error message to user. But user trying save the document with writemode undo posting until method ExchangePlans.EndWrite(), document saved successfully and then user delete the document. Result in XML message file will included record of the document posted while the document nonexistent. Then at the SecondaryNode read that message, the trouble "Some records in Accounting,Accumulation Registers losing references to recorder" to appear.

 
#6
People who like this: 0 Yes / 0 No
Just came
Rating: 1
Joined: Oct 8, 2013
Company:

If your users have permissions for deleting any documents without marking for deleting - it is no good. If they have one - you should handle this exceptions correctly or prohibit  direct deleting.

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