web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to save dynamic muitiple check box value in form

(0) ShareShare
ReportReport
Posted on by

Hi everybody,

I make questionare with dynamic checkbox control in form. I loaded answers from

salesAnswerTable table , so how to get event for saving them.

images2.png

And this is method for make questionare

private void addQuestionAnswerActual()
{
FormStaticTextControl formStaticTextControl;
FormCheckboxControl formCheckboxControl;
FormRadioControl formRadioControl;
int j,totalAnswer;

salesTable = salesTable::find('SO16-58976');

while select * from salesQuestionTable order by RecId
where salesQuestionTable.SalesId == SalesTable.SalesId
{
formStaticTextControl = GroupQuestion.addControl(FormControlType::StaticText, "DynamicStringControl");
formStaticTextControl.text(strFmt("%1. %2",salesQuestionTable.questionId(),salesQuestionTable.questionName()));

j = 0;
while select * from salesAnswerTable
order by AnswerId
where salesAnswerTable.SalesQuestionRecId == salesQuestionTable.RecId
{
formCheckboxControl = GroupQuestion.addControl(FormControlType::CheckBox,strFmt("chk%1",salesAnswerTable.AnswerId));
formCheckboxControl.label(salesAnswerTable.Name);
formCheckboxControl.dataSource("LagSalesAnswer");
formCheckboxControl.dataField(fieldNum(LagSalesAnswer,SelectValue));

}
}
}

and init() method.

public void init()
{
super();

this.addQuestionAnswerActual();
}

Please help me and give me any idea.

Thank so much

Rainy Huynh.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,284 on at

    Hi Rainy Huynh,

    Check boxes that you add are bound to data source, so as soon as user close the form all data is saved in underlying table. Now on a frorm close you can iterate through salesAnswerTable and check SelectValue field. If it is true then check box was checked, otherwise it was not. 

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Miroshnikov,

    Thank you your reply,

    I'm using salesAnswerTable table for create checkbox and connect to LagSalesAnswer datasource. When I checked checkbox ,value still not save in underlying table. I think salesAnswerTable table and LagSalesAnswer datasource can not connect in here,

    while select * from salesAnswerTable

                       order by AnswerId

                       where salesAnswerTable.SalesQuestionRecId == salesQuestionTable.RecId

           {

               formCheckboxControl =  GroupQuestion.addControl(FormControlType::CheckBox,strFmt("chk%1%2",i,salesAnswerTable.AnswerId));

               formCheckboxControl.label(salesAnswerTable.Name);

               formCheckboxControl.dataSource("LagSalesAnswer");

               formCheckboxControl.dataField(fieldNum(LagSalesAnswer,SelectValue));

           }

    Any idea please give me.

    Thanks so much.

  • Verified answer
    Mea_ Profile Picture
    60,284 on at

    Do you have "LagSalesAnswer" table behind LagSalesAnswer datasource ? If yes check values there. But it looks like all checkboxes have same field behind so if you will tick one does all of them get ticked ?

  • Community Member Profile Picture
    on at

    Hi Miroshnikov,

    Let me try again....thanks so much.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Sukrut Parab Profile Picture

Sukrut Parab 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans