Refresh data on parent form

I have two forms, lets call them FormA and FormB. Both use the same table as their data source. FormB is just used to flip a status field. FormA calls FormmB with a menuItemButton.In FormB, you field in some fields, hit ok and that modifies the data in the data source.

I have everything working correctly, but i was wondering if i did the closing proc for FormB correctly. FormB does the following…

int pos;
;
super();

pos = DataSource.getPosition();
DataSource.executeQuery();
callerForm.dataSource().refresh();
callerForm.dataSource().reread();
DataSource.setPosition(pos);

Now, i don;t like the use of the setPosition method but couldn’t find any other way to get it to work. is there a “better” way?

Why cannot you have the refresh logic on the parent form itself right after the super() in the click event or some thing like that…

I tried that. However, the code in the clicked method would execute completely then display FormB rather than displaying formB, waiting for a return then executing the code to refresh the dataSource.

even placing it after super()?

Yup. i put in a breakpoint just to make sure. the debugger pops up before the menuItem opens.

void clicked()
{
super();
breakpoint;
DataSource_ds.refresh();
DataSource_ds.reread();
DataSource_ds.research(true);
}

Hi,

try this, i hope it will help you,

void click()

{

FormRun fr;

MenuFunction mf;

Args args = new Args();

;

//super();

mf = new MenuFunction(menuitemdisplaystr(‘SalesTable’),MenuItemType::Display);

args.record(SalesLines);

fr = mf.create(args);

fr.run();

fr.wait(true);

SalesLine_ds.reread();

SalesTable_ds.research(true);

}

thanks for all the help!

Try this,

On child form

in class declaration method

Formdatasource callingformdatasource;

in init method of child form

callingformdatasource = element.args().record().datasource();

then after whatever operation you want to refresh the parent form data in that write following code.

callingformdatasource.executeQuery();

callingformdatasource.refresh();

Hope this will be helpfull to you.

Thnx,

Kirtan Dave

Thanks. I got there eventually but looks like i forgot to update this thread. I did this.

salesLineDatasource.executeQuery();
salesLineDataSource.findRecord(localSalesLine);
salesLineDataSource.refresh();

where localSalesLine is a record buffer that is being manipulated by a custom process.