TabularSection Delete problem

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Mar 6, 2018
Company: Bodega LLC

Hello!
I want to delete selected row on tabular section. But after deletion it gives index error(i think). I tried to clear and load the list but same error.

Error Message:

{DataProcessor.DepoSiparişUN.Form.Form.Form(59)}: Error calling context method (Get)
MID = object.Siparişler.Get(SelectedRow).IDDescription;
, reason:
Invalid parameter value (parameter number '1')
Invalid parameter value (parameter number '1')

 
#2
People who like this:0Yes/0No
Interested
Rating: 16
Joined: Dec 4, 2017
Company:

Dear eyup yilmaz,

Could you please send us detailed steps to reproduce the issue?

Best regards,
Vladimir Gurov

1C Company support team
 
#3
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Mar 6, 2018
Company: Bodega LLC

Hello again!

I have two different query. One of them filing one tabular section with "OnOpen()" procedure. Second query filling second tabular section according to selection from first tabular section. i want to delete selected row from first tabular section.

1-) if i delete directly selected row with delete, next time selection give index error if selection under the line of deleted line. For example if i delete a line which is index = 5, then i cannot select line wich index > 5.
2-) I tried to load first tabular section again (according to my first query unwanted line wont be in the list), but same error...

I hope i could explain my problem... Thanks for helps!

 
#4
People who like this:0Yes/0No
Interested
Rating: 16
Joined: Dec 4, 2017
Company:

Dear eyup yilmaz!

Thank you for the information you provided.

Unfortunately, it is not enough to reproduce the issue. Could you please provide us with a sample infobase (in *.dt format) where the issue can be reproduced?

Best regards,
Vladimir Gurov

1C Company support team
 
#5
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Mar 6, 2018
Company: Bodega LLC

Actually it is not possible to send infobase, because there is lots of information in it:( But if it is going to work i can send my codes.


Code
&AtClient
Procedure OnOpen(Cancel)
   // Ins ert handler content.
   ListeDoldur();
EndProcedure

&AtServer
Function ListeDoldur()
   VT = New ValueTable;
   //{{QUERY_BUILDER_WITH_RESULT_PROCESSING
   // This fragment was built by the wizard.
   // Warning! All manually made changes will be lost next time you use the wizard.
   
   Query = New Query;
   Query.Text = 
   "SELECT
   |   Sipariş.ID.Description AS IDDescription,
   |   Sipariş.ID AS ID,
   |   Sipariş.Bölüm.Description AS BölümDescription
   |FROM
   |   Document.Sipariş AS Sipariş
   |WHERE
   |   Sipariş.Ona yUn = FALSE
   |
   |GROUP BY
   |   Sipariş.ID.Description,
   |   Sipariş.ID,
   |   Sipariş.Bölüm.Description
   |
   |UNI ON ALL
   |
   |SELECT
   |   SıcakSatışSipariş.ID.Description,
   |   SıcakSatışSipariş.ID,
   |   SıcakSatışSipariş.Bölüm.Description
   |FROM
   |   Document.SıcakSatışSipariş AS SıcakSatışSipariş
   |WHERE
   |   SıcakSatışSipariş.Ona yUn = FALSE
   |
   |GROUP BY
   |   SıcakSatışSipariş.ID,
   |   SıcakSatışSipariş.ID.Description,
   |   SıcakSatışSipariş.Bölüm.Description";
   
   QueryResult = Query.Execute();   
   //}}QUERY_BUILDER_WITH_RESULT_PROCESSING
   
   //VT = QueryResult.Unload();
   //Object.Siparişler.Clear();
   Object.Siparişler.Load(QueryResult.Unload());
endfunction

&AtClient
Procedure SiparişlerSelection(Item, SelectedRow, Field, StandardProcessing)
   // Ins ert handler content.
   Object.Ona yUn = False;
   MID = object.Siparişler.Get(SelectedRow).IDDescription;
   Bolum = object.Siparişler.Get(SelectedRow).BölümDescription;
   if Bolum <> "Sıcak satış" then
      SiparişTopla(MID);
   else
      SiparişTopla_SıcakSatis(MID);
   endif;
   a = object.Ürünler.Count();
   for i = 0 to a-1 do
      object.Ürünler.Get(i).Stok = StokModul.kalan_UID(Object.Ürünler.Get(i).UrunIDCode);
   enddo;
   
EndProcedure

&AtServer
Function SiparişTopla(MID)
   VT = New ValueTable;
   //{{QUERY_BUILDER_WITH_RESULT_PROCESSING
   // This fragment was built by the wizard.
   // Warning! All manually made changes will be lost next time you use the wizard.
   
   Query = New Query;
   Query.Text = 
   "SELECT
   |   SiparişUrunler.UrunID.Code AS UrunIDCode,
   |   SiparişUrunler.UrunID.Description AS UrunIDDescription,
   |   SUM(SiparişUrunler.Adet) AS Adet
   |FROM
   |   Document.Sipariş.Urunler AS SiparişUrunler
   |WHERE
   |   SiparişUrunler.Ref.ID.Description = &Description
   |   AND SiparişUrunler.Ref.Ona yUn = FALSE
   |   AND SiparişUrunler.UrunID.Depo.Description = &Depo
   |
   |GROUP BY
   |   SiparişUrunler.UrunID.Code,
   |   SiparişUrunler.UrunID.Description,
   |   SiparişUrunler.UrunID.KutuAdeti";
   
   Query.SetParameter("Description", MID);
   Query.SetParameter("Depo","Un deposu");
   QueryResult = Query.Execute();
   
   //}}QUERY_BUILDER_WITH_RESULT_PROCESSING
   
   VT = QueryResult.Unload();
   Object.Ürünler.Load(VT);
endfunction

&AtServer
Function SiparişTopla_SıcakSatis(MID)
   VT = New ValueTable;
   //{{QUERY_BUILDER_WITH_RESULT_PROCESSING
   // This fragment was built by the wizard.
   // Warning! All manually made changes will be lost next time you use the wizard.
   
   Query = New Query;
   Query.Text = 
   "SELECT
   |   SıcakSatışSiparişUrunler.UrunID.Code AS UrunIDCode,
   |   SıcakSatışSiparişUrunler.UrunID.Description AS UrunIDDescription,
   |   SUM(SıcakSatışSiparişUrunler.Adet) AS Adet
   |FROM
   |   Document.SıcakSatışSipariş.Urunler AS SıcakSatışSiparişUrunler
   |WHERE
   |   SıcakSatışSiparişUrunler.Ref.ID.Description = &Description
   |   AND SıcakSatışSiparişUrunler.Ref.Ona yUn = FALSE
   |   AND SıcakSatışSiparişUrunler.UrunID.Depo.Description = &Depo
   |
   |GROUP BY
   |   SıcakSatışSiparişUrunler.UrunID.Code,
   |   SıcakSatışSiparişUrunler.UrunID.Description";
   
   Query.SetParameter("Description", MID);
   Query.SetParameter("Depo","Un deposu");
   
   
   QueryResult = Query.Execute();
   
   //}}QUERY_BUILDER_WITH_RESULT_PROCESSING
   
   VT = QueryResult.Unload();
   Object.Ürünler.Load(VT);
endfunction


&AtClient
Procedure OnayUnOnChange(Item)
   // Ins ert handler content.
   var parameter;
   cevap = new NotifyDescription("onayizni",ThisObject,parameter);
   ShowQueryBox(cevap,"Onay verildikten sonra geri alınamaz! Onaylamayı kabul ediyor musunuz?",QuestionDialogMode.YesNo,,DialogReturnCode.No,"Onay izni",);
EndProcedure

&AtServer
Function TopluOnay(MID)
   //{{QUERY_BUILDER_WITH_RESULT_PROCESSING
   // This fragment was built by the wizard.
   // Warning! All manually made changes will be lost next time you use the wizard.
   
   Query = New Query;
   Query.Text = 
   "SELE CT
   |   Sipariş.Ref AS Ref
   |FROM
   |   Document.Sipariş AS Sipariş
   |WHERE
   |   Sipariş.ID.Description = &MID
   |   AND Sipariş.Ona yUn = FALSE";
   
   Query.SetParameter("MID", MID);
   
   QueryResult = Query.Execute();
   
   SelectionDetailRecords = QueryResult.Sele ct();
   
   While SelectionDetailRecords.Next() Do
      // Insert selection processing SelectionDetailRecords
      //Documents.Sipariş...Ona yUn = True;
      Doc = SelectionDetailRecords.Ref.GetObject();
      Doc.Ona yUn = True;
      Doc.Write(DocumentWriteMode.Write);
      Doc.Write(DocumentWriteMode.Posting);
      
   EndDo;
   
   //}}QUERY_BUILDER_WITH_RESULT_PROCESSING
   
   
EndFunction

&AtServer
Function TopluOnay_SıcakSatis(MID)
   //{{QUERY_BUILDER_WITH_RESULT_PROCESSING
   // This fragment was built by the wizard.
   // Warning! All manually made changes will be lost next time you use the wizard.
   
   Query = New Query;
   Query.Text = 
   "SELE CT
   |   SıcakSatışSipariş.Ref AS Ref
   |FROM
   |   Document.SıcakSatışSipariş AS SıcakSatışSipariş
   |WHERE
   |   SıcakSatışSipariş.ID.Description = &MID
   |   AND SıcakSatışSipariş.Ona yUn = FALSE";
   
   Query.SetParameter("MID", MID);
   
   QueryResult = Query.Execute();
   
   SelectionDetailRecords = QueryResult.Sel ect();
   
   While SelectionDetailRecords.Next() Do
      // Insert selection processing SelectionDetailRecords
      Doc = SelectionDetailRecords.Ref.GetObject();
      Doc.Ona yUn = True;
      Doc.Write(DocumentWriteMode.Write);
      Doc.Write(DocumentWriteMode.Posting);
      
   EndDo;
   
   //}}QUERY_BUILDER_WITH_RESULT_PROCESSING
   
   
EndFunction


&AtClient
Function onayizni(sonuc,parameter) export
   if sonuc = DialogReturnCode.Yes then
      a = Object.Ürünler.Count();
      StokYeterli = True;
      for i = 0 to a-1 do
         Stok = Number(Object.Ürünler.Get(i).Stok);
         Adet = Number(Object.Ürünler.Get(i).Adet);
         if Adet > Stok then
            message(Object.Ürünler.Get(i).UrunIDCode + " ürününden " + (Adet - Stok) + " adet yetersiz");
            StokYeterli = False;
            Object.Ona yUn = False;
         endif;
      enddo;
      if StokYeterli = True then
         MID = items.Siparişler.CurrentData.IDDescription;
         Bolum = items.Siparişler.CurrentData.BölümDescription;
         if Bolum <> "Sıcak satış" then
            TopluOnay(MID);
         else
            TopluOnay_SıcakSatis(MID);
         endif;
      EndIf;
      object.Ürünler.Clear();
      //object.Siparişler.Delete(items.Siparişler.CurrentRow);
      //items.Siparişler.Refresh();
      //indx = object.Siparişler.IndexOf(items.Siparişler.CurrentRow);
      //object.Siparişler.Delete(indx);
      //items.Siparişler.Refresh();
      //ListeDoldur();
   else
      Object.Ona yUn = False;
   endif;
   
EndFunction

 
#6
People who like this:0Yes/0No
Interested
Rating: 16
Joined: Dec 4, 2017
Company:

Dear eyup yilmaz,

Thank you for the information you provided.

Unfortunately, the piece of code alone is not enough for analyzing the issue. We understand that you cannot send the entire configuration where this code works.

Maybe you could prepare an external data processor with a form and the code and sent it to us? It would help us investigate and resolve the issue for you.

Best regards,
Vladimir Gurov

1C Company support team
 
#7
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Mar 6, 2018
Company: Bodega LLC

I have prepared "dt" file. Create a document,list will be fill, then double click row it will deleted. Then try to delete next row, you will see the error.

 
#8
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Mar 6, 2018
Company: Bodega LLC

Hello again!

Still i couldn't find the way for solution, do you have any suggestions?

 
#9
People who like this:0Yes/0No
Interested
Rating: 16
Joined: Dec 4, 2017
Company:

Dear eyup yilmaz,

We are still investigating the issue and will return with investigation results soon.

Best regards,
Vladimir Gurov

1C Company support team
 
#10
People who like this:0Yes/0No
Interested
Rating: 16
Joined: Dec 4, 2017
Company:

Dear eyup yilmaz,

In the sample you sent us, use the following code:

Code
&AtClient
Procedure TabularSection1Selection(Item, SelectedRow, Field, StandardProcessing)
                
                CurrentRow = Items.TabularSection1.CurrentData;
                Object.TabularSection1.Delete(CurrentRow.LineNumber - 1);
                
EndProcedure


Best regards,
Vladimir Gurov

1C Company support team
 
#11
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Mar 6, 2018
Company: Bodega LLC

it is working! Uraaaaa! :) Thank you very much!

 
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.