Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

help with containers

Posted on by Microsoft Employee

I have a form which has a grid and a second form which opens from a menu item.

I have passed arguments from Form A  to Form B.

Now on form B ,I have a string edit control(which has no datasource attached to it).

Now , I am showing a value on that string edit control...so that when I select a record on grid and click on Form B.the value that  was saved on string edit control should show but everytime when Form B is opened.,the string edit control is blank.

Please help me just by letting me know that how can I use container on that string edit to just show the relevant grid's value.

*This post is locked for comments

  • Martin Dráb Profile Picture
    Martin Dráb 230,214 Most Valuable Professional on at
    RE: help with containers

    Because you chose such bad design, you'll have to implement everything manually by yourself. Therefore it'll be much more work to get much less useful form (without the ability to search, for instance).

    When closing the form, you'll have to pack the data, put it into the field and either create or update the record.

    When opening the form, you must find the record (if it exists), read the container, unpack it and set unpacked values to the unbound fields.

    Start by designing a data model for storing the data.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: help with containers

    Thanks for understanding Martin, So as I said I have a form which has a grid and a second form which opens from a menu item.

    I have passed arguments from Form A  to Form B.

    Now on form B ,I have 3 string edit control(which has no datasource attached to it).

    now,whatever value I will enter on those control ,they should appear the next time the form is reopened for the respective grid's record.

    I have used these two macros as:

    Table1         tableLocal;

      str                             S1, S2, S3;

       #define.CurrentVersion(1)

       #Localmacro.CurrentList

       S1,

       S2,

       S3

       #endmacro

    Now  I have created a pack() and unpack method:

    public container pack()

    {

       S1=   first.text();

       S2=   Second.text();

       S3=   Third.text();

       return [#CurrentVersion, #CurrentList];

    }

    public boolean unpack(container packedClass)

    {

     Integer     version     = conPeek(packedClass,1);

       switch (version)

       {

           case #CurrentVersion    :   [version,#CurrentList] = packedClass;

           break;

           default :    return false;

       }

           return true;

    }

    Now,I want to know how to get the last entered values every time when the second form is opened.I want those values to be filled in container field avaialble in my table..so that whenever I click on a record in the grid..that particular record's value show appear in stringedit unbound control.

  • Martin Dráb Profile Picture
    Martin Dráb 230,214 Most Valuable Professional on at
    RE: help with containers

    Well, maybe you should learn how to design applications in the right way. It looks like you're investing yours (and ours!) time to learn something you shouldn't ever use. I think focusing on things you'll need in real world would be wiser.

    But all right... please explain why you're "unable to store the packed values in container field on your table". We can't help you to solve the problem if you don't tell us what problem you have.

  • Martin Dráb Profile Picture
    Martin Dráb 230,214 Most Valuable Professional on at
    RE: help with containers

    Why exactly do you want to use four unbound controls and store them in a custom table as a container, instead of modeling them as normal fields in your custom table and displaying them in the form as usual?

    I enumerated the disadvantages of your approach in the other thread and I'm interested what benefits you expect to get. It still looks a bad design to me.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: help with containers

    Hi Martin,

    I went through the blog but it did not answer my question..

    I know I should not be using container,,I am using it just for learning purpose here.

    I have packed the value ,I am not able to store the packed values in container field on my table

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: help with containers

    Hi Evan,

    in this example, it;s fetching the last cached value..however I am trying to store the packed container value in a  container field in my table

  • Martin Dráb Profile Picture
    Martin Dráb 230,214 Most Valuable Professional on at
    RE: help with containers

    Note that I responded to the same question last week in the thread also named Help with container. It was asked by Arjun Tiwari, while this thread was created by Roshni Tiwari.

  • Suggested answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: help with containers

    You need to implement pack/unpack and last* methods on the form. Here is a blog post with example www.arbelatech.com/.../get-last-selected-value-on-form-control.html

    Create new variables to store unbound control values and add them to macro, so they get packed and unpacked, then set value of the controls, everything is described in the blog.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: help with containers

    Hi,

    I am passing current selected record 's argument .

    And the new form opened has 4 unbound controls ...I want to get the same value which was entered last time on those unbound controls.

    I have passed the argument but I am failing to achieve the unbound control part.

    when I enter anything on those unbound control and close the form and reopen it ,,,the content entered get disappear.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,280 Super User 2024 Season 2 on at
    RE: help with containers

    Hi Roshni,

    Can you describe in detail what you have done so far to pass the arguments? Do you need to pass a single value or multiple? If you have a single string value, then a container is not required. When you provide your details, we can see if you forgot something.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans