Refresh Form from Subform

karl
Member Posts: 22
Dear all,
Is there any ways to refresh form from a subform? Here is my situation:
subform's field: No. amount
0 100
0 100
1 200
1 200
2 50
2 50
2 50
Form's field: total amount = 350 --> count per No.
(not 750 --> can't use flowfield)
So, I have one field and one subform. I hope that when I modify amount field in the subform, it will also automatically refresh the value of field in the form. So far, the amount value (in the form) can only be refreshed after the pointer moving out from subform.
Can someone help me? Thanks
Karel
Is there any ways to refresh form from a subform? Here is my situation:
subform's field: No. amount
0 100
0 100
1 200
1 200
2 50
2 50
2 50
Form's field: total amount = 350 --> count per No.
(not 750 --> can't use flowfield)
So, I have one field and one subform. I hope that when I modify amount field in the subform, it will also automatically refresh the value of field in the form. So far, the amount value (in the form) can only be refreshed after the pointer moving out from subform.
Can someone help me? Thanks
Karel
0
Answers
-
Hi Karel,
A simple solution is to show the total in the subform - just like the info panel on sales orders0 -
Hi Karl
Unfortunately, the Sub Form (form, not control) has no concept of the header form which it is a sub form of, so you can't force an update of the main form after a certain event on the sub form.
This leaves you with a few options:
1. Forget about it and just be aware that the field on the header will only be updated when you click somewhere in the header to activate it.
2. Intrinsically link the field to a function, so that the field on the header only gets updated after you run a certain function, Functions > Release on a Sales Order for example.
3. And this is a fudge... ..set a timer running on your main form with CurrForm.UPDATE in the OnTimer() trigger. This is a bit of a sledgehammer to crack a nut, but does work if you absolutely had to have it. You may also get some flickering of your subform. Oh, and it would be fairly resource intensive way to fix a small issue.
Good luck0 -
Sendoh
be smart before being a clever.0 -
Hi all,
Thanks for the reply and suggestion. Sendoh, could you tell me how to use XMLDom that has been suggested by Garak ? well, sorry to ask this simple question because I'm just a beginner in NAV programming :oops: I've been tried to import the code into my NAV4SP3 environment but find some syntax error.
Thanks,
Karel0 -
if you're looking for a running type total.
here's another way
http://www.mibuso.com/forum/viewtopic.php?t=250560 -
hi karl,
what is the specific error?Sendoh
be smart before being a clever.0 -
Savatage, thanks for your idea, it is nice.
Sendoh, here is step to duplicate:
1. Copy all the code into text file.
2. In NAV, import the text file from object designer (I'm only change the form ID) and receive this error:
There is a syntax error in the import on line 15 in position 11: Create(XmlDoc);.
The AL Code is not indented as much as the first lin.
Regards,
Karel0 -
because it is not indented..try this one..copy the code to notepad and import to your DB.
OBJECT Form 60000 main form { OBJECT-PROPERTIES { Date=06/12/08; Time=11:17:23 AM; Modified=Yes; Version List=; } PROPERTIES { Width=5610; Height=4180; OnOpenForm=BEGIN CREATE(XMLDoc); CurrForm.SubForm.FORM.SetXMLDoc(XMLDoc); END; OnCloseForm=BEGIN CLEAR(XMLDoc); END; } CONTROLS { { 1000000000;TextBox;330 ;440 ;2800 ;440 ;Editable=No; SourceExpr=vTotal } { 1000000001;SubForm;330 ;990 ;3630 ;1760 ;Name=SubForm; SubFormID=Form60001 } } CODE { VAR vTotal@1000000000 : Decimal; XMLDoc@1000000001 : Automation "{F5078F18-C551-11D3-89B9-0000F81FE221} 4.0:{88D969C0-F192-11D4-A65F-0040963251E5}:'Microsoft XML, v4.0'.DOMDocument40" WITHEVENTS; EVENT XMLDoc@1000000001::ondataavailable@198(); BEGIN END; EVENT XMLDoc@1000000001::onreadystatechange@-609(); BEGIN IF (XMLDoc.readyState = 4) THEN BEGIN vTotal := CurrForm.SubForm.FORM.GetText(); CurrForm.UPDATE(FALSE); END; END; BEGIN END. } } OBJECT Form 60001 Sub form { OBJECT-PROPERTIES { Date=06/12/08; Time=11:18:17 AM; Modified=Yes; Version List=; } PROPERTIES { Width=2640; Height=1320; } CONTROLS { { 1000000000;TextBox;110 ;110 ;2310 ;440 ;SourceExpr=vValue1; OnAfterValidate=BEGIN SendMessage; END; } { 1000000001;TextBox;110 ;660 ;2310 ;440 ;SourceExpr=vValue2; OnAfterValidate=BEGIN SendMessage; END; } } CODE { VAR vValue1@1000000000 : Decimal; vValue2@1000000001 : Decimal; XmlDoc@1000000002 : Automation "{F5078F18-C551-11D3-89B9-0000F81FE221} 4.0:{88D969C0-F192-11D4-A65F-0040963251E5}:'Microsoft XML, v4.0'.DOMDocument40"; PROCEDURE SetXMLDoc@1000000000(pXMLDoc@1000000000 : Automation "{F5078F18-C551-11D3-89B9-0000F81FE221} 4.0:{88D969C0-F192-11D4-A65F-0040963251E5}:'Microsoft XML, v4.0'.DOMDocument40"); BEGIN XmlDoc := pXMLDoc; END; PROCEDURE SendMessage@1000000002(); BEGIN XmlDoc.loadXML('<root></root>'); END; PROCEDURE GetText@1000000004() : Decimal; BEGIN EXIT(vValue1+vValue2); //----------to be pass to main form----------- END; EVENT XmlDoc@1000000002::ondataavailable@198(); BEGIN END; EVENT XmlDoc@1000000002::onreadystatechange@-609(); BEGIN END; BEGIN END. } }
hope will help..Sendoh
be smart before being a clever.0 -
Wow, thanks Sendoh. It works \:D/
Thanks for your help. CASE CLOSED.0 -
don't forget to mark it [SOLVE]Sendoh
be smart before being a clever.0 -
Can anyone tell me how to close a topic ? :-k
I can't find it in FAQ.
Karel0 -
Hi Sendoh
That was brilliant - haven't got a clue that it works but it does!
Well done that man!
Cheers
Big DBig D signing off!0 -
ho, that looks like my code ;-)Do you make it right, it works too!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions