Record Selection with check boxes

Keiona007
Keiona007 Member Posts: 3
Hi,

I'm looking for a way to select records throught checkboxes.

For examples, each customer in the system can be assign specific items.
I need to go in the item list and select the ones I need and transfer them to my custom table.

***I already did the work with MARKONLY but the customer wants checkboxes instead.

My problem is that if the field "select" is in the item table, i need to reset it each time which is not great... and if the select field is a varaible in the form, when I check it, all records are checked at the same time. How can I make the field be specific to one record?

Thanks very much for your replies!
K :)

Comments

  • markborges
    markborges Member Posts: 170
    Keiona007 wrote:
    ***I already did the work with MARKONLY but the customer wants checkboxes instead.

    I would insist a little bit on your idea, because he's trying to change Nav default behavior, but ok, I know how customers are... :lol:
    Keiona007 wrote:
    My problem is that if the field "select" is in the item table, i need to reset it each time which is not great...

    I think this is the better idea. But when resetting the "select" field, try use "MODIFYALL" sentence instead of "MODIFY" for each record. See if it makes difference or not.

    :wink:
    Marcelo Borges
    D365 Business Central Solutions Architect
    BC AL/NAV C/AL Developer
    BC Repositories.com
  • kriki
    kriki Member, Moderator Posts: 9,135
    You can keep a temptable on item in memory and each time the user clicks a checkbox of an item you can save the item in the temptable or delete it from the temptable. And the checkbox is true when the record for that item is in the temptable.
    So you need a global boolean "blnChecked" variable that you use as variable for the checkbox.
    In the OnAfterGetRecord, you fill the blnChecked variable
    blnChecked := tmpItem.GET("No.");
    

    In the OnAfterValidate of the checkbox:
    IF blnChecked THEN BEGIN
      tmpitem := rec;
      IF tmpitem.INSERT(FALSE) THEN ;
    END
    else BEGIN
      IF tmpitem.GET("No.")  THEN
        tmpItem.DELETE(FALSE);
    END;
    

    And when you want to loop the checked items, you just loop the temptable.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Waldo
    Waldo Member Posts: 3,412
    Look in form 720 (BA Field Selection).

    It is implemented there like Kriki proposed.

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • Keiona007
    Keiona007 Member Posts: 3
    Thanks all for your input! It works like magic :)