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)

array of checkBoxes

(0) ShareShare
ReportReport
Posted on by

Hello Everyone!

I would like to dynamically create a few checkBoxes and insert them into a form.

FormCheckBoxControl cBox[];
//returns error "illegal basetype in array cBox

for(i=0;i<=10;i++)
{
cBox[i]. //there is nothing after dot :(
}

Is there any way to add array of elements to form with different names like in C#?


My final goal is form with possibility to choose BOM names, returning table with items they contain to compare. I just couldn't do it by report.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    X++ doesn't support arrays of objects. Nevertheless you can use collection classes such as List and Array.

    Can you tell us more about your actually requirement? There may be a better way to achieve it than generating controls at runtime.

  • Community Member Profile Picture
    on at

    Well, for example:

    We have 5 BOM's, lets call them BOM0, BOM1... BOM4. Each of them contains few items inside. My leader want me to develop (for training) something (whatever it might be) to compare element inside BOM's.

    You, Mr. Martin, suggested me to use SSRS report, what is, of course, perfect solution. But I decide to expand functionally of this "device".

    I would like to create a form (I think, it's form) with CheckBoxes, where User will choose BOMs he want to compare. After that he receives complete tables with content of each BOM separately.

    I know how to perform it in Visual Studio using .NET, but, sadly, it is far different than X++.

    PS. Do you think that some day Microsoft will resign from X++ in AX creating new version of .NET usable both in casual object development and AX?

  • Verified answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    Why don't you simply use a grid with a checkbox column, for example? By the way, creating such controls in code would be weird in .NET as well, if you use data binding (and you probably should).

    I don't see any problem in X++ - I don't even see any problem here that requires using code.

  • Community Member Profile Picture
    on at

    I have never herd bout data binding, so much knowledge in one conversation :)

    Getting back to business. I have found possibility to add grid into a form and checkBox into it, but only manually. I can't find any information about adding full column of items.

    Is it even possible in just and only AOT? If it will not be generated from code I have no idea how to dynamically adding and renaming them.

    My main problem is that, theoretically, solution should work despite number of unique MOBId's.

  • Community Member Profile Picture
    on at

    Ok, the column is done, now I need some labels, and logic.

    Should I generate separate label for each of items, or is there something like "text" property?

  • Community Member Profile Picture
    on at

    I see, there is no labels, this column is a part of table. Now it becomes clear :)

    So logic...

  • Community Member Profile Picture
    on at

    Two questions:

    1. How can I test wich checkBoxes on grid are checked?

    2. How to create table where each record occurs only once (column a,a,b,a,c,c,c becomes a,b,c)?

  • Community Member Profile Picture
    on at

    Am I doing it correctly?

     BOMVersion BV;

       BOMId tempName;

       while select * from BOMVersion

       {

           if(tempName != BOMVersion.BOMId)

           {

               tempName = BOMVersion.BOMId;

               // in this place I would like to move my unique

               // value into table in grid

           }

       }

    And what can I do to populate table inside grid?

  • Verified answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    To your two questions:

    1. Typically by filtering the table used as the data source for the checkbox.

    2. Don't insert any record more than once. You can create a unique index to enforce that.

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
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans