Loop Insert Record

LeoNavLeoNav Member Posts: 55
Hi, :D

I need to create records based on a multiple selection. Here is my keys :

Qualification Code,Type,Code

What I need is that the system creates a list of records (that works) but for the Qualification code I have selected previously. For the moment, it creates an entire new record. So what I need is for example :

Qualification code AA25 (selected from the form 01). Afterwards, I select several lines on a form 02 and click on OK button. At this moment I need the system to create several records (loop) but for the Qualification code AA25. So how can I identify the qualification code that is used at the moment ?

Here is the code of my button (TRIGGER OnPush)
Cpt:=0;
CurrForm.SETSELECTIONFILTER(SelectionTest);
IF SelectionTest.FINDSET THEN
REPEAT
  Cpt:=Cpt+1;
  Table56204.INIT;
  Table56204."Qualification Code" :=; !!!! ISSUE 
  Table56204.Type := Table56204.Type::Job;
  Table56204.Code := SelectionTest."No.";
  Table56204.INSERT;
UNTIL SelectionTest.NEXT = 0;

Thanks :D

Comments

  • mabl4367mabl4367 Member Posts: 143
    I'm not sure I understand what you are trying to do but I thing your problem is that you need a way to pass the selected qualification code selected in form1 to form2 where you want to use it for setting the Table56204."Qualification Code".

    Create a function in form2 called fnSetQualificationCode:
    fnSetQualificationCode(newCode : Code(20))
      qualificationCode := newCode;
    

    Call the function from form1:
    form2.fnSetQualificationCode(selcetedCode);
    

    In the loop in form2 use the global variable that was set by the function call
    pt:=0;
    CurrForm.SETSELECTIONFILTER(SelectionTest);
    IF SelectionTest.FINDSET THEN
    REPEAT
      Cpt:=Cpt+1;
      Table56204.INIT;
      Table56204."Qualification Code" := qualificationCode; 
      Table56204.Type := Table56204.Type::Job;
      Table56204.Code := SelectionTest."No.";
      Table56204.INSERT;
    UNTIL SelectionTest.NEXT = 0;
    
Sign In or Register to comment.