Search code examples
axaptadynamics-ax-2009x++dynamics-ax-2012

setTmpData() on dynamically added form DataSource


I have added a datasource to a form using the standard pattern:

Args args;
FormRun formRun;

Form form;
FormBuildDataSource formBuildDataSource;
;

form = new Form(formstr(ICS));
formBuildDataSource = form.addDataSource('dbm_ICStmp');
//formBuildDataSource.table(tablenum(dbm_ICStmp));

args = new Args();
args.object(form);

formRun = classfactory.formRunClass(args);

formRun.init();
formRun.run();
formRun.detach();

dbm_ICStmp is a temporary table. How do I call setTmpData?


Solution

  • I can recommend you some things about this:

    1. Use the classFactory to create your form (The Args class - Classfactory)
    2. Instead of adding your datasource through code outside the form, try to put the temporary table as the datasource on your form.
    3. When you open the form the temporary table will be empty, but then you can add data by using the setTmpData(MyTemporaryRecordInstance) method. MyTemporaryRecordInstance is then a temporary table that you filled up prior to that. For more information, you can find all you need to know about temporary tables in form on the following link : Temporary tables in forms