List Form Sorting

cole.rutherford
Member Posts: 12
Is there a way to code how I want a form to sort?
I have a form that I needs sorting different way depending where the user tries to view the form. Thanks in advance.
I have a form that I needs sorting different way depending where the user tries to view the form. Thanks in advance.
0
Comments
-
Yes.
You can do it in two ways
If you just want to set different than default sorting order, different but still fixed, you can simply set RunFormView property on button which is used to run the form. IF the form is launched via button
In order to have full flexibility you can write some code in OnLookup trigger.
1. Create variable based on form fou want to display
2. Create record on wchich the form is based
3. use SETCURRENTKEY on record to select key you want to display
4. you may also use SETFILTER if there is a need to narrow number of records
5. write formbasedvariable.SETTABLEVIEW(recordbasedvariable)
6. write formbasedvariable.RUNMODAL or formbasedvariable.RUN
If you want to pick some selected data from displayed form you'll have to write additional some code.
Regards,
Slawek.Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
Appreciate the help.0
-
Is there a way to set the order, ascending or decending, in code? We have all the code for the filtering, we just need to sort accordingly.0
-
cole.rutherford wrote:Is there a way to set the order, ascending or decending, in code? We have all the code for the filtering, we just need to sort accordingly.
Seach for the function called ASCENDING in the C/SIDE help.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
There is a Table.SETVIEW(String) and GETVIEW, in V4, But the help is not any good, no example.
Just create a form with the View you want then copy the SourceTableView, don't save the form.
Like I have done Here with the Item Table.
myItem.SETVIEW('SORTING(No.) ORDER(Descending)');
Please let us know if it works ok.From Dynamics help
SETVIEW (Record)
Use this function to set the current sort order, key and filters on a table.
Record.SETVIEW(String)
String
Data type: text or code
The string format is the same as the SourceTableView property on forms.
Comments
The value of the String parameter can be one returned by GETVIEW.
If the SETVIEW function is executed with an empty string, all filters are removed and the primary key is used.Analyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0
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