Switching between two data sources at runtime in a form

rashi.kaushik
Member Posts: 52
Hi All
I am Customizing the SalesOrder form.
I have added a view also to the existing data sources of the form.
Now the requirement is that there will be a check box on the form itself and as soon as the user checks the check box the forms data source should switch to view and vice versa.
Thanks in advance
Rashi
I am Customizing the SalesOrder form.
I have added a view also to the existing data sources of the form.
Now the requirement is that there will be a check box on the form itself and as soon as the user checks the check box the forms data source should switch to view and vice versa.
Thanks in advance
Rashi
0
Comments
-
Hi
Simply said, you should duplicate the existing form controls and link the duplication controls to fields in the View (while the origial controls remain linked to the table). Then switch controls visibility when the checkbox is changed and make sometime visible only those having ds=salestable, then hide those and only show the others (with the View).
However this way you are complicating very much the screen. Why not creating a brand new form identical with the first (by duplicating it) and with the View as datasource. Place a button on each form to open the other with the correct parameters, so the user will always get access to both forms.
HTH...Kind regards,
Ciprian Dudau
Axapta Developer0 -
Thanks Mugur
Now the form's design changes as i try to click the checkbox.
But my problem now is:
I have 2 Views
SalesTableView and SalesLineView
When i click the checkbox the form comes in view mode but now since there is no realtion between these views the SalesLineView does not display the related records instead it display all the records.
I have set the JoinSource property of SalesLineView in data source as SalesTableView.
Thanks in advance
Rashi0 -
Yes, I tested and the same happened to me ](*,) . We need to do some tricks for this.
Add in classdeclaration() of the form the following:QueryBuildRange rangeSalesId;
Then in datasource SalesViewLines.init() (after super() call)rangeSalesId = this.query().datasourceno(1).addrange(fieldnum(SalesViewLines,SalesId));
Then in datasource SalesViewTable.active() (also after super() call)rangeSalesId.value(salesViewTable.salesId); SalesViewLines_ds.executequery();
This should work.Kind regards,
Ciprian Dudau
Axapta Developer0 -
Thanks Mugur.
Its working absolutely fine now.
Thanks a lot once again.
Rashi0 -
Hi Mugur,
Can u pls help me with this also.
Now the same problem is with the MarkUpTrans table also.
When i Salestable form is in View mode i.e. the datasources are SalesTableView and SalesLineView and i open MarkUpTrans from SalesTableView the MarkUpTrans is also opened in view mode i.e. the DS is MarkUpTransView but its not showing the related records. The DS of the menu Item Button of MarkUptrans is SalesTableView.
Thanx in advance
Rashi0
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