Problem in code of transfering multiple lines

vyanku
vyanku Member Posts: 791
I create lines in requsition worksheet.
Now I want to transfer them in requsition table without deleting.
So I write code on onpush trigger of one new button for it as below,
But By using this code I have to select one line and only that line will be transfer.means I can transfer only one line at a time.
What I have to do so that I can transfer all line at a time.

req record requsition table
   req.INIT;
   req."Indent No.":="Indent No."  ;
   req."Line No.":="Line No.";
   req."Item No.":="No.";
   req.Date:="Order Date";
   req."Requested by":="Requester ID";
   req.location:="Location Code";
   req.Description:=Description;
   req.Quantity:=Quantity;
   req."User iD":="User ID";
   req."Global Dimension Code 1" := "Shortcut Dimension 1 Code";

   req.INSERT;
   
   END;

Comments

  • MissesMagic
    MissesMagic Member Posts: 39
    Do you want to change all records in the table or only these ones shown on the form??
  • vyanku
    vyanku Member Posts: 791
    I just want all these records in req table without delete them from requsition worksheet.
  • Mbad
    Mbad Member Posts: 344
    Have you considered somthing like this(not real code)
    ReqWksh.setfilter(FilterFromRecordset);
    if ReqWksh.findset then
      repeat
        OtherRecord.init;
        Blah Blah
        OtherRec.insert;
      until ReqWksh.next = 0;
    
  • vyanku
    vyanku Member Posts: 791
    Yes just like that
    But this type of code is not working because when u write
    find('-') then
    repeat
    until
    it will again come on first line which was already transfered. I will not come on next line.
  • DenSter
    DenSter Member Posts: 8,307
    Only if the find('-') is inside the loop. Take a close look at the structure in Mbad's pseudocode. It does the FIND first, and only if it finds records does it go into the loop.
  • vyanku
    vyanku Member Posts: 791
    What is the use of Findset function in this code??
    I tried the same also. but nothing is happend....... ](*,)
  • DenSter
    DenSter Member Posts: 8,307
    Check the C/AL reference guide (Help -> C/AL Reference Guide) for information about FINDSET.