Running Subpage on Temporary Record in NAV 2016
Rishi1109
Member Posts: 43
Hello Friends ,
Is it any how possible to run subpage on a Temporary Record set which will be populated through code written in OnOpenPage of main Page ?
Any help would be highly appreciated.
Thanks and Regards
Rishi
Is it any how possible to run subpage on a Temporary Record set which will be populated through code written in OnOpenPage of main Page ?
Any help would be highly appreciated.
Thanks and Regards
Rishi
Thanks and Regards
Rishi
Rishi
0
Answers
-
You have posted the question and the answer - populate the temp record in the subpage through the code.
Build a function on your subpage which will populate the data, and call it on OnAfterGetCurrentRecord on the main page, passing the relevant parameters (or a record) from the main page - so the data in the subform can be related to the record actually displayed on the main page.Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-031 -
Thanks Slawek for your time but I just wanted to understand that if I have put Rec1 as sourcetable property of subpage then where and how to assign TempRec1 to rec1Thanks and Regards
Rishi0 -
You need to have a code on the subpage populating your Rec record on the subpage
On your subpage you need someting like this:SetSubpageData (some paramerer1...) Rec.RESET; Rec.DELETEALL; //**make sure the 'old' data is gone SomeSourceRecord.SETRANGE(field, paramerer1) // REPEAT Rec.Field1 = SomeSourceRecord.Field1 //and so on Rec.INSERT; //**insert new data into Rec on the subpage UNTIL you have all the data in Rec IF Rec.FINDSET THEN;
The Rec on the supbage is your source record on that subpage, the SourceTableTemporary property on the subpage must be set to Yes.
It does not matter how you set values on the Rec record; using a set of assignments as on the mockup code above, use Rec := SomeOtherRecordOftheTypeSameAsRec, or if you use SomeDifferentRecotr.TRANSFERFIELDS(Rec); Once you have set all required fields you simply do Rec.INSERT to insert new record into your subpage.
If you already have some data prepared in some temp record you need to pass your temprecord to the Page. then pass it further down to the subpage, and copy the data from the temprecord to Rec on the subpage.
You can pass your temprecord to the Page in two ways: If your page is based on the same record type you ou can run your page by calling RUN(PageID, temprecord), and then you need to pass by reference you Rec record from the header to the function on the subpage.
If your header shows data from different record than temprecord then you need to add another function on the header, define page as variable, and call this new function on page variable to setup data in subpage before calling PageVar.RUN
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
OnOpenPage Trigger -
I normally never suggest to call anything or large set of code from this trigger until and unless its deadly needed. It will slow down your Page.Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/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