List Form - Allow only one record to be selected

doddwelldoddwell Member Posts: 65
Hello

I have a list form that displays a list of Batches. I have a menu button on the form that allows the user to Post, Cancel or View Batch Documents. I want to prevent the user from being able to Select more than one record. If this is not possible, what's the best way of performing a count of the selected records when the user presses the menu button?

Thanks very much.

Comments

  • SonGoten13SonGoten13 Member Posts: 44
    you could either use
    CurrForm.SETSELECTIONFILTER(YourRec);
    IF YourRec.COUNT <> 1 THEN ...
    
    OR
    just use the current Rec for following code and dont loop throught all the data
  • doddwelldoddwell Member Posts: 65
    Thanks SonGoten13

    The first method works for me. I amended it slightly though. After using the SetSelectionFilter function, my batch list form is filtered to the users selection and I don't want this...so my code now looks like this:

    RetroDiscbatch.COPY(Rec);
    CurrForm.SETSELECTIONFILTER(RetroDiscbatch);

    IF RetroDiscbatch.COUNT > 1 THEN
    ERROR('Count : %1',RetroDiscbatch.COUNT);
  • ReinhardReinhard Member Posts: 249
    Hi Doddwell,
    yup, that will work.
    But do notice one thing in SonGoten's reply.
    He did NOT put in "Rec" as the parameter to SETSELECTIONFILTER, but instead a new variable, similar to the RetroDiscbatch.
    (...Retro Disco... makes me want to dance... \:D/ \:D/ )

    so you could amend your code one step further:
    //RetroDiscbatch.COPY(Rec);  //not needed
    CurrForm.SETSELECTIONFILTER(RetroDiscbatch);
    
    IF RetroDiscbatch.COUNT > 1 THEN
    ERROR('Count : %1',RetroDiscbatch.COUNT);
    

    - Reinhard
Sign In or Register to comment.