How to identify selected rows

imurphy
Member Posts: 308
Is is possible to identify the currently selected rows in a grid on a form?
I want the user to select a few rows with shift.click and to then click on a button to perform an action on those rows.
I thought it might be the Markedonly function but it doesn't appear to do what I want.
I want the user to select a few rows with shift.click and to then click on a button to perform an action on those rows.
I thought it might be the Markedonly function but it doesn't appear to do what I want.
0
Comments
-
SETSELECTIONFILTER, look it up in the C/SIDE reference guide (in the help menu)0
-
I'm sitting here with D.Studebakers book and couldn't find anything related to the subject. Searching for selection/select etc on mibuso didn't turn up anything either.
Thanks, all I needed was a starting point.
Ian0 -
Hi Ian,
Look at the GetSelectionFilter() function on the main list forms (item,customer,vendor) which uses CURRFORM.GETSELECTIONFILTER funchion and is very useful0 -
GetSelectionFilter???? I can't find any references to it anywhere. Where did you find it.
Ian0 -
Hi Ian,
Lokk in the master list forms e.g. form 31 Item list - this function is used from the Analysis By Dimension form 7158 in the onlookup trigger of the item filter and works like
item selected 1000,1001,1002,7000
returns string 1000..1002|7000 8)0 -
I've set up a button which the user will click on after selecting the rows they want. I have copied a few lines from form 31 to test this out. The onpush event handler looks like this:
CurrForm.SETSELECTIONFILTER(SelectedSalesLine); SelectedSalesLine.FIND('-'); SalesLineCount := SelectedSalesLine.COUNT;
but it fails on the first line with an error sayingCopying all filters at once can only be done between records belonging to the same table.
Table: Sales Line <-- Sales Header
Copy the necessary filters one at a time.
The only documentation consists of a single, not very helpful line.
When I am in a Sales Order (form 42) do I need to use CurrForm to refer to the sales line or should I be somehow tracking down the subform object and using that?
What does the SetSelectionFilter method actually do?
I have to pass it a record - but it doesn't say *what* record - will this contain the resultset or is it the set of records in the form?
Since it doesn't return a result, what does it do with this record?0 -
Hi Ian,
The SETSELECTIONFILTER command works on the source table on the calling form so if your case the command will return Sales Header record(s) and you are trying to assign this to a sales line. If you want to select the subform that you will need to use the SETSELECTIONFILTER is the sub-form and process from there. If you want to button on the main form then write a function in the sub-from and call this from the main form.
Hope this helps.0 -
Aha, hadn't thought about writing a method on the subform.
I've been digging around for a way to find a reference to the subform table.
Thanks
Ian0 -
-
Just in case someone else is trying this out for the first time, this works for me ...
Modify the subform showing the lines you want the user to multi-select. Add a button and attach something like the code below to the onpush. It makes a change to each selected line on a grid.CurrForm.SETSELECTIONFILTER(SelectedSalesLine); SelectedSalesLine.FINDFIRST; SalesLineCount := SelectedSalesLine.COUNT; IF SelectedSalesLine.FINDFIRST THEN REPEAT SalesLineCount := SalesLineCount - 1; IF SelectedSalesLine.Quantity <>0 THEN BEGIN SelectedSalesLine."Qty. to Invoice" := SelectedSalesLine.Quantity * (PercentageToAssign/100); SelectedSalesLine.MODIFY; END; //MESSAGE (SelectedSalesLine.Description ); UNTIL SelectedSalesLine.NEXT = 0;
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