Refresh on FormLevel

Hi,

I wanted to perform InventTable grid refresh.

I have implemented one customization on InventTable Form module. It will fired when a selected item will be deleted successfully from InventTable as well as from Grid. But after that if my customization gets some error and it failes then i wanted to revert back the deleted AX item.

I achieved it by using “ttsabort” but at this point required to refresh the grid again.

Currently i have perofrmed the InventTable_ds.research(true);

it works but while refreshing it refresh whole grid and it seems while InventTable form is getting refreshing. it is not good behaviour.

I have also tried doreread, reread as well as refresh and refreshEX. But all of these not showing any effect on InventTable grid.

Any suggesions will greatly appreciated.

Hai Ashlesh

Try writing this 3 lines :

FormDatasource.reread();

FormDatasource.refresh();

FormDatasource.active();

Replay if still fails.

Hi chakrandhar,

it still not working as expected.

Thanks for the reply.

Hai

Are you doing your customizations in the Clicked() method of the form or in the class level methods.

i mean you are doing delete operation.Where you are doing this.In class level or in form level.

Hi, I am doing my customization on form level. That means i have wrritten my code on button clicked event.

If you are doing delete opeartion in class level then you should access your form data source in the class.

It is some thig like this.

FormdataSource abc; // Delclare form datasource in the class;

;

abc = element.args.datasource();

abc.reread();

abc.refresh();

Hai

It should work in form level.I have worked many scenarious like this.Please check the code once again.Check with super(); placing it at the top of code.

Check whether the data source is linked to button group.If still dont work i am sorry.

Hai aslesh

http://kashperuk.blogspot.com/2010/03/tutorial-reread-refresh-research.html

Analyse the code below


void clicked()
{
PurchLine tmpPurchLine;
PurchLine updatePurchLine;
PurchLine selectedRecord;

Dialog dl;
DialogField dlfTransdate;
;

dl = new Dialog(“Change confirmed date”);
dlfTransdate = dl.addFieldValue(typeid(“Transdate”),today(),“Confirmed date”);
if(dl.run()){
selectedRecord = PurchLine_ds.cursor();
for (tmpPurchLine = PurchLine_ds.getFirst(true) ? PurchLine_ds.getFirst(true) : PurchLine_ds.cursor();
tmpPurchLine; tmpPurchLine = PurchLine_ds.getnext())
{
ttsbegin;
SELECT FORUPDATE updatePurchLine
WHERE updatePurchLine.PurchId == tmpPurchLine.PurchId
&& updatePurchLine.VendAccount == tmpPurchLine.VendAccount
&& updatePurchLine.LineNum == tmpPurchLine.LineNum
&& updatePurchLine.ItemId == tmpPurchLine.ItemId;
updatePurchLine.ConfirmedDlv = dlfTransdate.value();
updatePurchLine.update();
ttscommit;
}
PurchLine_ds.reread();
PurchLine_ds.research();
PurchLine_ds.findRecord(selectedRecord);
}
super();
}

void clicked()
{
PurchLine tmpPurchLine;
PurchLine updatePurchLine;
PurchLine selectedRecord;

Dialog dl;
DialogField dlfTransdate;
;

dl = new Dialog(“Change confirmed date”);
dlfTransdate = dl.addFieldValue(typeid(“Transdate”),today(),“Confirmed date”);
if(dl.run()){
selectedRecord = PurchLine_ds.cursor();
for (tmpPurchLine = PurchLine_ds.getFirst(true) ? PurchLine_ds.getFirst(true) : PurchLine_ds.cursor();
tmpPurchLine; tmpPurchLine = PurchLine_ds.getnext())
{
ttsbegin;
SELECT FORUPDATE updatePurchLine
WHERE updatePurchLine.PurchId == tmpPurchLine.PurchId
&& updatePurchLine.VendAccount == tmpPurchLine.VendAccount
&& updatePurchLine.LineNum == tmpPurchLine.LineNum
&& updatePurchLine.ItemId == tmpPurchLine.ItemId;
updatePurchLine.ConfirmedDlv = dlfTransdate.value();
updatePurchLine.update();
ttscommit;
}
PurchLine_ds.reread();
PurchLine_ds.research();
PurchLine_ds.findRecord(selectedRecord);
}
super();
}

void clicked()
{
PurchLine tmpPurchLine;
PurchLine updatePurchLine;
PurchLine selectedRecord;

Dialog dl;
DialogField dlfTransdate;
;

dl = new Dialog(“Change confirmed date”);
dlfTransdate = dl.addFieldValue(typeid(“Transdate”),today(),“Confirmed date”);
if(dl.run()){
selectedRecord = PurchLine_ds.cursor();
for (tmpPurchLine = PurchLine_ds.getFirst(true) ? PurchLine_ds.getFirst(true) : PurchLine_ds.cursor();
tmpPurchLine; tmpPurchLine = PurchLine_ds.getnext())
{
ttsbegin;
SELECT FORUPDATE updatePurchLine
WHERE updatePurchLine.PurchId == tmpPurchLine.PurchId
&& updatePurchLine.VendAccount == tmpPurchLine.VendAccount
&& updatePurchLine.LineNum == tmpPurchLine.LineNum
&& updatePurchLine.ItemId == tmpPurchLine.ItemId;
updatePurchLine.ConfirmedDlv = dlfTransdate.value();
updatePurchLine.update();
ttscommit;
}
PurchLine_ds.reread();
PurchLine_ds.research();
PurchLine_ds.findRecord(selectedRecord);
}
super();
}

Hi, But as per the link “http://kashperuk.blogspot.com/2010/03/tutorial-reread-refresh-research.html” which you have provided, it is wrong to use research() with reread().

If you find the solution please tell me.

Try using un excecutequery on the datasource of the grid

PurchLine_ds.executeQuery();

Hi Ashlesh,

Please go throught this Link… you will surely find the solution.

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

Hi lilly,

Thanks it worked for me.