AX 2012AX 2012 R3X++

Filtering Inventory Dimensions (Drop Down) Based on the value of Item Id (Drop Down) in SSRS Report Parameters

HI all
Recently i have come across a scenario where i have to filter the values of inventory dimension based on the value of item id in parameters of an SSRS Report so this is what i did, i hope it will be helpful for someone.

first create a contract class as given below

public class InventDimFilterContract
    ItemIdSmall                 item;
    InventDimId                 InventDimId;


public ItemIdSmall parmItemname(ItemIdSmall _item = item)
    item = _item;
    return item;


public InventDimId parmInventDimId(InventDimId _inventDimId = inventDimId)
   inventDimId = _inventDimId;
    return inventDimId;


now Create a UIbuilder Class as given below 

Public class InventDimFilterUIBuilder extends SysOperationAutomaticUIBuilder
    DialogField                         dialogItem;
    DialogField                         dialoginventdim;
    InventDimFilterContract          contract;


now create a biuld method to draw the dialog boxes

public void build()
    Dialog  dialoglocal = this.dialog();
    contract = this.dataContractObject();

    this.addDialogField(methodStr(InventDimFilterContract  ,parmItemname), contract);
    this.addDialogField(methodStr(InventDimFilterContract ,parmInventDimId), contract);

Now Create a lookup method for item id 

public void lookupItemname(FormStringControl _control)
    Query query = new Query();
    SysTableLookup systablelookup;
    QueryBuildDataSource queryBuildDataSource,qbds;

    systablelookup = SysTableLookup::newParameters(tableNum(InventTable), _control);
    sysTableLookup.addLookupField(fieldNum(InventTable, ItemId));
    sysTableLookup.addLookupField(fieldNum(InventTable, NameAlias));
    queryBuildDataSource = query.addDataSource(tableNum(InventTable));
    qbds = queryBuildDataSource.addDataSource(tableNum(InventDimCombination));
    qbds.addLink(fieldNum(InventTable, ItemId),fieldNum(InventDimCombination,ItemId));

    queryBuildDataSource.addGroupByField(fieldNum(InventTable, ItemId));
    queryBuildDataSource.addGroupByField(fieldNum(InventTable, NameAlias));



now create another method so that when user selects any record from item drop down, the invent dim drop down will be filtered with that value, for this reason we will select the modified event of item and then type the code as given below 

public boolean itemnameModified(FormStringControl _control)
    return true;


now create the lookup method for inventdim

public void lookupinventdimid(FormStringControl _control)
    Query query = new Query();
QueryBuildDataSource queryBuildDataSource, qbds, dsView;
QueryBuildRange queryBuildRange;
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(InventDim), _control);
sysTableLookup.addLookupField(fieldNum(InventDim, InventDimId));
sysTableLookup.addLookupField(fieldNum(InventDim, configId), false);
    sysTableLookup.addLookupField(fieldNum(InventDim, InventSizeId), false);
    sysTableLookup.addLookupField(fieldNum(InventDim, InventColorId), false);
    sysTableLookup.addLookupField(fieldNum(InventDim, InventStyleId), false);

queryBuildDataSource = query.addDataSource(tableNum(InventDim));
qbds = queryBuildDataSource.addDataSource(tableNum(InventDimCombination));
qbds.addLink(fieldNum(InventDim, InventDimId), fieldNum(InventDimCombination, InventDimId));

    // This is the key part, what we want to filter to be displayed in the grid.
    qbds.addRange(fieldnum(InventDimCombination, ItemId)).value(dialogItem.value());



code for lookups and their filters have been completed. Now we will bind our dialog boxes with the contract class parms and also override the modified method of item with the method we just wrote. To do this we will create another method for postBuild
public void postbuild(){    super();
    dialogItem = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(InventDimFilterContract ,parmItemname));    if (dialogItem)    {    dialogItem.lookupButton(2);    }
    dialogItem.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(InventDimFilterContract ,lookupItemname), this);    dialogItem.registerOverrideMethod(methodStr(FormStringControl, modified),methodStr(InventDimFilterContract ,itemnameModified), this);
    dialoginventdim =  this.bindInfo().getDialogField(this.dataContractObject(),methodStr(InventDimFilterContract ,parmInventDimId));    dialoginventdim.registerOverrideMethod(methodStr(FormStringControl, lookup), methodStr(InventDimFilterContract ,lookupinventdimid),this);    if(dialoginventdim)    {    dialoginventdim.lookupButton(2);    }}

few other methods will also be created in order to function the code properly. 
Those are getFromDialog, initializeFields and postRun. 
Create three new methods each for getFromDialog, initializeFields and postRun as given below

public void getFromDialog()
    contract = this.dataContractObject();


public void initializeFields()
    contract = this.dataContractObject();


public void postRun(){    super();}
All done But forget not to  reference your UI builder class just below the DataContractAttribute as given below
[DataContractAttribute,SysOperationContractProcessingAttribute(classStr(InventDimFilterUIBuilder ))]public class InventDimFilterContract{    ItemIdSmall                 item;    InventDimId                 InventDimId;}

all done now. 

58 thoughts on “Filtering Inventory Dimensions (Drop Down) Based on the value of Item Id (Drop Down) in SSRS Report Parameters

  1. Hi I am so thrilled I found your web site, I really found you by accident, while I was researching on Yahoo for something else,
    Anyways I am here now and would just like to say
    kudos for a tremendous post and a all round interesting blog (I also
    love the theme/design), I don’t have time to look over it all at the minute but I have saved it and
    also added in your RSS feeds, so when I have time I will be back to read more, Please do keep up
    the awesome jo.

  2. Howdy are using WordPress for your site platform? I’m new to the blog world but I’m trying to get started and create my own. Do
    you need any coding knowledge to make your own blog?
    Any help would be greatly appreciated!

  3. Greetings from Ohio! I’m bored to tears at work so I decided to check out your website on my iphone during lunch break. I love the information you present here and can’t wait to take a look when I get home. I’m surprised at how quick your blog loaded on my mobile .. I’m not even using WIFI, just 3G .. Anyways, superb site!

  4. Hello! I know this is kind of off topic but I was wondering if
    you knew where I could get a captcha plugin for
    my comment form? I’m using the same blog platform as yours and I’m
    having problems finding one? Thanks a lot!

  5. Thanks for your marvelous posting! I seriously enjoyed reading it, you’re a great author.I will be sure to bookmark
    your blog and will come back later on. I want to encourage you to ultimately continue your great writing, have a nice holiday weekend!

  6. I have been browsing online greater than three hours nowadays,
    yet I never discovered any interesting article like yours.
    It’s lovely price sufficient for me. In my opinion, if all website owners and bloggers made just right content material as you probably did, the net
    shall be much more helpful than ever before.

  7. Great items from you, man. I have remember your stuff prior to
    and you’re simply too fantastic. I really like what you have received right here,
    really like what you are stating and the way wherein you say it.
    You are making it entertaining and you still care for to keep it wise.

    I can’t wait to read much more from you. This is actually a wonderful website.

  8. Thanks a lot for sharing this with all of us you really
    know what you’re speaking approximately! Bookmarked.
    Please also seek advice from my site =). We
    may have a hyperlink change contract among us

  9. Hey There. I found your weblog using msn. That is an extremely neatly written article.

    I’ll make sure to bookmark it and come back to read extra of your helpful information. Thanks for the post.
    I will definitely comeback.

  10. I’m really impressed with your writing skills and also with the layout on your
    weblog. Is this a paid theme or did you modify it yourself?
    Anyway keep up the nice quality writing, it is rare
    to see a great blog like this one these days.

  11. I truly love your site.. Very nice colors & theme. Did
    you make this site yourself? Please reply back as I’m wanting to
    create my own personal blog and would like to learn where you got this from or exactly what the theme is called.

  12. I am really loving the theme/design of your weblog. Do you ever run into any web browser compatibility
    problems? A few of my blog audience have complained about my website not working correctly in Explorer but looks great in Firefox.
    Do you have any ideas to help fix this issue?

  13. Woah! I’m really enjoying the template/theme of this blog.
    It’s simple, yet effective. A lot of times it’s tough to
    get that “perfect balance” between superb usability and appearance.
    I must say you have done a excellent job with this.
    Also, the blog loads very quick for me on Firefox. Exceptional Blog!

  14. Hi, i read your blog from time to time and i own a similar one and i was just wondering if
    you get a lot of spam remarks? If so how do you protect
    against it, any plugin or anything you can suggest?
    I get so much lately it’s driving me insane so any help is very much appreciated.

  15. My brother recommended I might like this web site.
    He was once entirely right. This submit truly made my day.
    You can not consider simply how much time
    I had spent for this info! Thanks!

  16. Nice post. I was checking constantly this blog and I am impressed!
    Extremely helpful information specially the last
    part 🙂 I care for such information a lot. I was seeking this particular information for a very long time.
    Thank you and best of luck.

  17. I happen to be commenting to make you understand of the superb experience my wife’s daughter went through visiting your blog. She figured out a lot of pieces, not to mention what it’s like to have an amazing teaching character to let other individuals without hassle comprehend selected hard to do subject areas. You actually surpassed our own expected results. Many thanks for coming up with these useful, trusted, explanatory and also unique thoughts on the topic to Kate.

  18. Hi would you mind sharing which blog platform you’re using?
    I’m planning to start my own blog in the near future but I’m having
    a difficult time selecting between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your design and style seems different then most blogs and I’m
    looking for something unique. P.S My apologies for being off-topic but I had to ask!

  19. Its like you learn my thoughts! You seem
    to understand a lot about this, such as you wrote the guide in it or something.
    I think that you can do with a few % to power the message house a bit, but instead of that, that is great blog.
    A great read. I will definitely be back.

  20. I must show some appreciation to you just for bailing me out of such a issue. Just after looking throughout the the net and obtaining techniques that were not helpful, I figured my life was well over. Existing devoid of the solutions to the difficulties you have fixed all through your entire post is a critical case, as well as those which might have in a wrong way affected my entire career if I hadn’t encountered the website. Your primary natural talent and kindness in taking care of the whole lot was useful. I don’t know what I would have done if I hadn’t discovered such a thing like this. I can now relish my future. Thank you very much for this professional and amazing guide. I will not hesitate to suggest your web sites to anybody who would like support on this area.

  21. Hey just wanted to give you a quick heads up and let you know a few
    of the images aren’t loading correctly. I’m not sure why but I think
    its a linking issue. I’ve tried it in two different browsers and both
    show the same results.

  22. Hiya! I know this is kinda off topic however I’d figured
    I’d ask. Would you be interested in trading links or maybe guest
    writing a blog post or vice-versa? My blog covers a lot of the same subjects
    as yours and I think we could greatly benefit from each other.

    If you might be interested feel free to shoot me an e-mail.
    I look forward to hearing from you! Great blog by the way!

  23. I happen to be commenting to make you understand what a magnificent discovery my friend’s child undergone viewing your site. She noticed many things, not to mention what it is like to possess a wonderful coaching nature to get many more really easily understand selected grueling things. You really exceeded her expectations. I appreciate you for rendering such insightful, dependable, informative and as well as cool tips on that topic to Kate.

  24. I wanted to put you a tiny note in order to give many thanks once again on the nice tactics you’ve documented on this page. This has been quite pretty open-handed of people like you to deliver unhampered what a few individuals could possibly have offered as an e-book to help with making some money on their own, even more so since you might have done it if you considered necessary. The things as well worked to provide a easy way to fully grasp other people online have a similar dream similar to my personal own to know the truth very much more on the topic of this matter. Certainly there are numerous more pleasurable opportunities in the future for individuals that view your site.

Leave a Reply

Your email address will not be published.