Filter

kangal74
Member Posts: 15
Hi
I need to create a filter for my table.
I have 2 field ( famille, type ) and i want to filter only the record where the 2 fields have the same value.
I try this , and thats dont work:
Table.SETRANGE(Table.Famille,Table.type);
Best regards
Kangal
I need to create a filter for my table.
I have 2 field ( famille, type ) and i want to filter only the record where the 2 fields have the same value.
I try this , and thats dont work:
Table.SETRANGE(Table.Famille,Table.type);
Best regards
Kangal
0
Comments
-
May I know where did you write above code?
and where do you need this? form/report?0 -
It s on form .
I try several position to place the text.
I need it on the onopenform and on the onlookup
I try this on the onlookup:
FormFamille.LOOKUPMODE := TRUE;
FormFamille.EDITABLE := FALSE;
SETFILTER(Type,Famille);
IF FormFamille.RUNMODAL = ACTION::LookupOK THEN BEGIN
FormFamille.GETRECORD(Rec);
END;
CLEAR(FormFamille);
CurrForm.UPDATE(FALSE);
dont work .0 -
May I know exact requirement? so that we can suggest someother work around..0
-
If you're using the form variable approach, you need to set the table view. E.g.,
FormFamille.LOOKUPMODE := TRUE;
FormFamille.EDITABLE := FALSE;
SETFILTER(Type,Famille);
FormFamille.SETTABLEVIEW(Rec);
IF FormFamille.RUNMODAL = ACTION::LookupOK THEN BEGIN
...0 -
MarkHamblin wrote:If you're using the form variable approach, you need to set the table view. E.g.,
FormFamille.LOOKUPMODE := TRUE;
FormFamille.EDITABLE := FALSE;
SETFILTER(Type,Famille);
FormFamille.SETTABLEVIEW(Rec);
IF FormFamille.RUNMODAL = ACTION::LookupOK THEN BEGIN
...
IF I use Setrange , the table are filtered but with the '' value.
Thats dont work.
Another idea ?
Best regards0 -
If I understand you correctly you want to only see the records where 2 different fields have the same value in the same record.
Like in this example:
famille type
Record1 A A <----
Record2 B A
Record3 C C <----
In that case you have to read every single record.
You could work with marks like in this post:
http://www.mibuso.com/forum/viewtopic.php?f=14&t=2673
Or you could work with a temporary table.Thomas Martin
NAV Developer0 -
This could be very useful to read some manuals in order to get some understanding how setrange and setfilter works before asking0
-
And also nicer ways to access look-ups. Here's some sample code that does what you need, but based on the sales header table. It looks up any sales headers of type "Order", and is much nicer syntax than using the form variable like you're trying to do.
SalesHeader.SETRANGE("Document Type", SalesHeader."Document Type"::Order);
IF FORM.RUNMODAL(FORM::"Sales List", SalesHeader) = ACTION::LookupOK THEN
MESSAGE(SalesHeader."No.");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