use of dialog box

Hello everyone,

my question is regarding ax 2009.

i have created a dialog box using Job.

till now i used to save the values entered in dialog box to tables by clicking ok button and used to retrieve the last inserted values in dialog box using querry.

Now i want to create a new dialog box in such a way that

i just enter the values and dont save them but when i open the dialog box next time i need to get the last values which i entered there…do i need to use pack or unpack?

pls provide me with code…or any example having this kind of code.

Hi Nick,

yes u need to use pack and unpack. Go through below links very help full to you

http://community.dynamics.com/ax/f/33/t/67248.aspx#.USrstPVnXcs

http://daxguy.blogspot.in/2006/12/use-packunpack-on-form.html

Regards,

Phani

Hi Nick,

If you want to create a dialog which would input your value and then show it next time with the same value or to persist with data, then you can use pack and unpack methods.

This you can find in standard functionality in Item BOM Type:

ItemDetails > BOM(Button) > Lines

and the class used is : BOMVersionApprove

Can you provide the code here…

what do i exactly write in pack and unpack methods i have created the dialog using class…

Hi Nick,

please go through this links… to understand about pack() and unpack() methods…

http://dynamicsuser.net/forums/t/19009.aspx

Under pack method write this:

public container pack()

{

;

return [#CurrentVersion,#CurrentList];// + [super()];

}

And under unpack:

public boolean unpack(container packedClass)

{

container _base;

boolean _ret;

Integer _version = conpeek(packedClass,1);

switch (_version)

{

case #CurrentVersion:

[_version, #CurrentList, _base] = packedClass;

//_ret = super(_base);

break;

default:

_ret = false;

}

return _ret;

}

And your class declaration looks like:

class ItemCreationApprove extends runbase

{

Dialogfield fieldapprover;

approvedby approver;

#define.CurrentVersion(2)

#localmacro.CurrentList

approver

#endmacro

}

Please note that these method am writing at class level.

Thanks vishal…