Hi All,
i have a refresh problem with a SubForm.
The situation is:
there is a form (MainForm), based on Table1. on this form, there is a SubForm, based on Table2. in Table1 there is a FlowField with CalcFormula like this: Sum(Table2.Amount WHERE (No.=FIELD(No.))
i have tested 2 case:
case 1: i put this FlowField to the MainForm. when i change a record on the SubForm, the FlowField doesn't calculates, until i activate the mainform. the problem is, that i cannot refresh the MainForm from the SubForm...
case 2: i create a global variable (Name myrec, type record, subtype Table1) on the SubForm, create a function refreshsub, what calculates the value of the FlowField (myrec), and put a TextBox to the SubForm with SourceExpression like this: myrec.flowfieldname.
on the OnAfterGetRecord trigger of the MainForm, i allways call this function. it works fine, the value of the flowfield is calculated (tried it with message), but the control doesn't refresh until i activate the subform, so it shows the old value of the flowfield.
has somebody a solution for this problem?
thx
0
Answers
You can also use the "OnAfterGetRecord"-trigger of the subform, but this will calculate the variable too many times.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
you could just refresh the main form with an OnTimer - CurrForm.UPDATE(TRUE);
Example: http://mibuso.com/dlinfo.asp?FileID=321
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
1) say that it is standard behaviour of Navision and teach users that if they want actual value, they need to click to the header
2) You can add some free space with editbox on top of the subform and calc the value on subform (I assume that it is some sum of some field from the subform) - you need to calcualate it on correct trigger on the subform
3) You can use Script shell library to simulate keypress Ctrl+Up, Ctrl+Down to refresh the header (search mibuso or mbsonline for that)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
using timer and sending keys... i don't think theese are acceptable technics...
kriki: i do the calculation in the OnAfterGetCurrentRecord trigger of the SubForm.
It works fine
but, the best solution would be, if the End User understands: this is how Navision works...
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
If I have a subform which can show 10 records. How many times are "OnAfterGetCurrentRecord" and/or "OnAfterGetRecord" called?
"OnAfterGetRecord" is triggered for ALL records that are shown.
If you want a good idea, put a message in the triggers, and then count the times a message pops up. You will be surprised how many times Navision updates the records.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
i don't know, which hacker was creating the End Users' kernel, but it is fully with bug...