enabling and disabling the checkBox over selected Record in Grid

I have Two Button which is called Click and Unclick .I have 10 records in form grid…and i have 10 checkBox also in Form …What i want is when i click the button by select the particular record in the Form grid checkBox is enabled…when i unclick the button by select the particular record checkBox should uncheck …when i run code the First record only Check and Uncheck…when select the second record it will not do any action …Mu codes are attached below…

Click:

void clicked()
{
MultiSelectionHelper selectionHelper = MultiSelectionHelper::construct();//Create instance of class
Set selectedRecords = new Set(Types::Record);//Declare a set of type record
Kipl tableLines; //Your table buffer
super();

selectionHelper.parmDataSource(Kipl_DS); //Set the datasource
tableLines = selectionHelper.getFirst(); //assign to table buffer the reference to selected record(s)

if (tableLines.RecId)
{
while(tableLines)
{

selectedRecords.add(tableLines);

CheckBox1.checked(true);

super();
info(strFmt(‘Selected record… %1 %2’,tableLines.id,tableLines.name));//Display selected record
tableLines = selectionHelper.getNext();
}

}
}

UnClick:

void clicked()
{
MultiSelectionHelper selectionHelper = MultiSelectionHelper::construct();//Create instance of class
Set selectedRecords = new Set(Types::Record);//Declare a set of type record
Kipl tableLines; //Your table buffer
super();

selectionHelper.parmDataSource(Kipl_DS); //Set the datasource
tableLines = selectionHelper.getFirst(); //assign to table buffer the reference to selected record(s)

if (tableLines.RecId)
{
while(tableLines)
{

selectedRecords.add(tableLines);

CheckBox1.checked(false);
// super();
info(strFmt(‘Selected record… %1 %2’,tableLines.id,tableLines.name));//Display selected record
tableLines = selectionHelper.getNext();
}
}
}

Guys help me

I was looking at it for a while, but I didn’t get what you did, why and what you need from us.
I would prefer if you forget about your code.
Instead, show us the design of your form - if I understand what you did, it’s a wrong design, but maybe I don’t understand you. A picture will make it clear.
Then we should be able to suggest a reasonable implementation.

I see that you’re not storing the value in database, but then I’m not sure why don’t you simply use the normal multi-selection provided by AX (checkboxes on the left side of the grid).
What business requirement are you implementing by this design?

How can i store that in dataBase.Can u help me ??.i was doing the task which assigned by our Organisation.

You would use a table field, of course. But do you really want it? If so, why your code saves the values in a Set object (which will disappear when you close the form)? These behaviour would be very different, therefore it’s all about required functionality.

How do you want to design a solution if you don’t know what it should do? If you didn’t get enough information (which is common in our job), ask the consultant or who gave you the requirement.

Hey [tag:martin] i am new from ax i am just now learning… so my company gave me training.
so only they insist like that … can u help me by code…??

if any bug in my code you just remove it …and made a correct code…

Feel free to ask question if you don’t understand something, but I’m not going to do your job for you (unless you hire me :)).
And even if I was willing, I still don’t know what the code should do, such as whether values should be persistent in database or not.

When it select the value in grid corresponding CheckBox is enabled so only it store data…when i run also the first record in grid make the checkBox enabled and disabled…after when i go with some other grid it wont enabled or disabled thats a problem…

I’m sorry, but you’ll have to elaborate what you mean by “after when i go with some other grid it wont enabled or disabled”. We can’t help you if you don’t explain your problems clearly enough.