SETSELECTIONFILTER : add selected records to another form

LeoNavLeoNav Member Posts: 55
Hi, :D

I have a form 01 with a field allowing me to select a record (but only one at a time) from an other form 02. I try tu use the SETSELECTIONFILTER function in order to select multiple values at a time but it doesn't work. I only have the record which the cursor is on.

I use a button and put this code on it (OnPush trigger) :
CurrForm.SETSELECTIONFILTER(SelectionTest);
IF SelectionTest.FINDSET THEN
REPEAT
MESSAGE('message test');
UNTIL NEXT = 0;

I read a lot of posts on it on Mibuso but I can't solve my problem.

An idea ?

Comments

  • kapamaroukapamarou Member Posts: 1,152
    edited 2010-12-08
    LeoNav wrote:
    Code: Select all
    CurrForm.SETSELECTIONFILTER(SelectionTest);
    IF SelectionTest.FINDSET THEN
    REPEAT
    MESSAGE('message test');
    UNTIL NEXT = 0;

    Is this how it is written?

    If so try the following:

    CurrForm.SETSELECTIONFILTER(SelectionTest);
    IF SelectionTest.FINDSET THEN
    REPEAT
    MESSAGE('message test');
    UNTIL SelectionTest.NEXT = 0;
  • MBergerMBerger Member Posts: 413
    maybe you should try
    UNTIL Selectiontest.NEXT = 0
    
  • LeoNavLeoNav Member Posts: 55
    Ok, it work.

    But I have an other problem. EvenIf I select many values, I only have one that is added the the form 02 when I push on the button.
  • kapamaroukapamarou Member Posts: 1,152
    I think we need to see the rest of the code for this. Maybe it is outside the loop?
  • LeoNavLeoNav Member Posts: 55
    For the moment, I have nothing else inside the loop than the message. I don't know how to select these records and add it to the form01. :D
  • ReinhardReinhard Member Posts: 249
    Hello,

    I tried your code and it worked fine. So that makes me think maybe the problem is how you are selecting the records...

    First, you will need a list form of some sort. Then, select the records you want by holding down either the SHIFT or CTRL key. They will be highlighted in blue. Then click on the button. You should see a test message for every record you have selected.

    If you do not highlight multiple records before running the code, it will only give you one test message, for the currently selected record, like you said.
  • LeoNavLeoNav Member Posts: 55
    Yes, now it's ok. I can have a multiple selection. Thanks you all for your help.

    LeoNav :D
  • LeoNavLeoNav Member Posts: 55
    Hi,

    I have this error "Copying all filters at once can only be done etwwen records beloinging to the same table" when I compile this code on my form :
    CLEAR(F_JobList);
    
    F_JobList.SETTABLEVIEW(Job);
    F_JobList.SETRECORD(Job);
    F_JobList.LOOKUPMODE(TRUE);
    IF F_JobList.RUNMODAL = ACTION::LookupOK THEN BEGIN
    
      Cpt:=0;
      CurrForm.SETSELECTIONFILTER(Job);
    
    
      IF Job.FINDSET THEN
      REPEAT
        Cpt:=Cpt+1;
        MESSAGE('%1',Cpt);
    
        T_Eligible56204.INIT;
    
        T_Eligible56204."Qualification Code" :=Rec.Code;
        T_Eligible56204.Type := T_Eligible56204.Type::Job;
        T_Eligible56204.Code := Job."No.";
        T_Eligible56204.Name := Job.Description;
        T_Eligible56204.INSERT;
    
      UNTIL Job.NEXT = 0;
    END;
    

    An idea ? :)
  • LeoNavLeoNav Member Posts: 55
    Nobody has a idea ?
  • vijay_gvijay_g Member Posts: 884
    what is this..
    CurrForm.SETSELECTIONFILTER(Job);

    what is job here?
Sign In or Register to comment.