Marking records on a lookup form and using MARKEDONLY

cssgyula
Member Posts: 31
Hi,
I am creating a field in which the user can create a filter expression. I have declared a text[250] variable and I don't allow the user to create a larger expression than that.
For the selection of multiple records I thought I will use the marking of records on the lookup form. My testcode looks like this.
I tried this code under NAV 4.0 and NAV 4.0 SP3, but I found out that the count of records before calling the MARKEDONLY are all records in the table, but after initiating the MARKEDONLY command, the count is always zero although there were records marked manually on the lookup form.
Further problems are, that I cannot go through all of the marked records, I can only asses the currently highlighted one on the lookup form, so I cannot collect the field values which are MARKED by the user on the lookup form.
What am I doing wrong?
The C/SIDE help says:
Thanks for your help,
I am creating a field in which the user can create a filter expression. I have declared a text[250] variable and I don't allow the user to create a larger expression than that.
For the selection of multiple records I thought I will use the marking of records on the lookup form. My testcode looks like this.
CLEAR(MyRecVariable); IF FORM.RUNMODAL(0,MyRecVariable)=ACTION::LookupOK THEN BEGIN MESSAGE(FORMAT(MyRecVariable.COUNT)); MyRecVariable.MARKEDONLY(TRUE); MESSAGE(FORMAT(MyRecVariable.COUNT)); END;
I tried this code under NAV 4.0 and NAV 4.0 SP3, but I found out that the count of records before calling the MARKEDONLY are all records in the table, but after initiating the MARKEDONLY command, the count is always zero although there were records marked manually on the lookup form.
Further problems are, that I cannot go through all of the marked records, I can only asses the currently highlighted one on the lookup form, so I cannot collect the field values which are MARKED by the user on the lookup form.
What am I doing wrong?
The C/SIDE help says:
Example
This example shows how to use MARK and MARKEDONLY. You should assume that initially none of the records are marked.
Customer.SETCURRENTKEY("No.");
Customer."No." := 'NEW 3500';
Customer.FIND('=');
Customer.MARK(TRUE); // Mark a record
No1 := Customer.COUNT;
Customer.MARKEDONLY(TRUE);
No2 := Customer.COUNT;
MESSAGE(Text000 + Text001, No1, No2);
Create the following text constants in the C/AL Globals window:
Text Constant
ENU Value
Text000
'Number of records before MARKEDONLY: %1\'
Text001
'Number of records after MARKEDONLY: %2'
The message window could show:
Number of records before MARKEDONLY: 5
Number of records after MARKEDONLY: 1
Thanks for your help,
Best Regards,
Gyula (Jules) Csiák-Sedivy
There are two things, which you cannot learn from books. True love and Software Coding.
Gyula (Jules) Csiák-Sedivy
There are two things, which you cannot learn from books. True love and Software Coding.
0
Comments
-
Did you highlight multiple lines in the form or did you mark them with CTRL-F1?0
-
Szia,
this will only work, if you create an instance from the form you want to use, and a function on the form, with a parameter type record (passed by reference), which marks the records in the parameter, as the records are marked on the form.
I mean for examlpe you want the user to mark Sales Quotes:
Create a form (or use the "Sales List"), and add a function:GetRecord(VAR SalesHeader : Record "Sales Header") RESET; SalesHeader.CLEARMARKS; IF FINDFIRST THEN REPEAT SalesHeader.GET("Document Type", "No."); SalesHeader.MARK(MARK); UNTIL NEXT = 0; SalesHeader.MARKEDONLY(TRUE);
and you can use it like this:SalesList.LOOKUPMODE := TRUE; SalesHeader.FILTERGROUP(6); SalesHeader.SETRANGE("Document Type", SalesHeader."Document Type"::Quote); SalesHeader.FILTERGROUP(0); SalesList.SETTABLEVIEW(SalesHeader); IF SalesList.RUNMODAL = ACTION::LOOKUPOK THEN BEGIN SalesList.GetRecord(SalesHeader); MESSAGE(FORMAT(SalesHeader.COUNT)); END;
Hope this helps.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