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)

Get FormList Value

(0) ShareShare
ReportReport
Posted on by

Hi guys, I am using a ListView function in a form. I had changed the value inside the form with checkbox together. But how should I get the value from the checkbox that I checked by using X++ coding? I will need to use the value in a select statement as a condition.

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hi, You can refer to \Forms\tutorial_Form_ListControl in MS Dynamics ax 2012.

    Following is a code snippet from same only. Hope it helps in picking selected checkbox item.

    //Starts

       FormListItem item;

       int i;

        i = listview.getNextItem(FormListNext::Selected);

       while (i != -1)

       {

           item = listview.getItem(i);

           print i,' ',item.text(),' ',item.idx();

           i = listview.getNextItem(FormListNext::Selected,i);

       }

    //Ends

  • Community Member Profile Picture
    on at

    Hi Sumit, I still couldn't get the value from the FormListView. I had try the code above but the value din't show out.

  • Community Member Profile Picture
    on at

    On clicking "Display selected " getting info log with Name and state checked[true/false].

    Code behind display selected :

     

    Hope it helps and answers your query!

  • Community Member Profile Picture
    on at

    Hi Sumit, the coding above solves parts of my problem. Actually i would like to get the checked item value and insert into a table. For example from the above picture, I checked the checkbox of Item 0 and Item 3, I want to insert the both value (Item 0, Item 3) into a table. Is it possible to make it?

  • Suggested answer
    Community Member Profile Picture
    on at

    I believe ,instead of displaying/printing in info log , you can assign same values to table fields and then insert .

    e.g.

    Testtable  testtable;

    //In a loop

    ttsbegin;

    testtable.field1 = item.text();

    testtable.field2 = item.stateChecked();

    testable.insert();

    ttscommit;

  • Community Member Profile Picture
    on at

    Hi Sumit, Sorry for asking some dumb question as I am still new to X++. If i want to check for the statechecked which is true and only insert the data to my table. How should i write the condition part?

  • Verified answer
    Community Member Profile Picture
    on at

     

    In the image above replace following:

    1. if(item) condition with if(item && item.statechecked())

    2. info(Strfmt(........)); with your table insert code.

     

  • Community Member Profile Picture
    on at

    Thank you so much, Sumit. This helps me a lot. :)

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
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans