Absolute Beginner / Form Property "SourceTableView"

Guybrush_Threepwood
Member Posts: 28
Heyho,
I´m absolutely new in Navision and run through basic training at the moment. While getting started with Form Design, I shall use the "Form\SourveTableView"-Property to filter all records with a certain value in a certain field.
The Property value looks like "WHERE(Emplymt. Contract Code=CONST(ADM))" from the Cronus Trial Company. It shows only the records from table "Employee" with value "ADM" in field "employment contract code".
My Question:
To set the Table Filter, the guide manual told me to use "CONST" as filtertype. Why is it "CONST" and not "FILTER"? is there any difference at all? If I replace "CONST" with "FILTER" the result seems to be the same.
I´m absolutely new in Navision and run through basic training at the moment. While getting started with Form Design, I shall use the "Form\SourveTableView"-Property to filter all records with a certain value in a certain field.
The Property value looks like "WHERE(Emplymt. Contract Code=CONST(ADM))" from the Cronus Trial Company. It shows only the records from table "Employee" with value "ADM" in field "employment contract code".
My Question:
To set the Table Filter, the guide manual told me to use "CONST" as filtertype. Why is it "CONST" and not "FILTER"? is there any difference at all? If I replace "CONST" with "FILTER" the result seems to be the same.
0
Comments
-
CONST is where the value is fixed, this can be a Type such as Order or a value such as 0
CONST is short for Constant (never changing)
The FILTER is used where you need to have a condition such as >0 or a range of values.Experience is what you get when you hoped to get money0 -
colingbradley wrote:CONST is where the value is fixed, this can be a Type such as Order or a value such as 0
CONST is short for Constant (never changing)
The FILTER is used where you need to have a condition such as >0 or a range of values.
Well, the example from guide manual is probably not very suitable to show that difference. in that concrete example, it makes no difference if i use "FILTER" or "CONST". I think as long as the value of the referred field has a fix value (code "ADM" in field "eplymt. contract" in the example is deposited once and normally doesn´t change) it doesn´t really care.
You mean, if the value in the source-field can present a range of different values, "FILTER" is more suitable?0 -
The difference is that you can use special symbols when you use FILTER option, for example '11..22', 'Cro*', '>=100'. Those symbols cannot be used when you select CONST option (actually - they can - but they will be interpreted differently:) - as a value - not as a filtering directive)Best regards,
Dmitry0 -
Hmm, if I understand that right ... as long as I exactly know what value I want to filter, there´s no difference between "CONST" and "FILTER". But the moment I don´t exactly know the value I want to filter I should use "FILTER", right?0
-
Guybrush_Threepwood wrote:Hmm, if I understand that right ... as long as I exactly know what value I want to filter, there´s no difference between "CONST" and "FILTER". But the moment I don´t exactly know the value I want to filter I should use "FILTER", right?
Hello Guybrush (I like these games :-)
not exaclty, you will use CONST if you have just ONE value you want to filter. You will use FILTER if you have MORE values or indefinite value... And another point of view: value in CONST is taken as VALUE, if you enter '' it does not mean empty string but value with two apostrophe. If you enter '' into FILTER, it will mean empty string. If you enter A|B into CONST, it will be filter for one value 'A|B'. If you enter A|B into filter, it will be filter to two walues - A or B. :-)0 -
okay, now i got it. thank you all for your help :-)0
-
Just one final thing, I have been told that CONST filtering works faster than the FILTER so should be used.
If you take notice of the code in the standard Navision you will notice that CONST is always used where possible so as a good developer, it is always best to go with the standard.Experience is what you get when you hoped to get money0 -
colingbradley wrote:... so as a good developer, it is always best to go with the standard.
This is rule no #1 for all developer issues =D>0 -
Mark Brummel wrote:colingbradley wrote:... so as a good developer, it is always best to go with the standard.
This is rule no #1 for all developer issues =D>
Kline answered the Question with 1 Value Const, more than one Filter.
I would say one thing though, in the examples, they tend to Hard Code these CONST values, but as a good practice "Never Hard Code", but use a setup table, then the values can change with the business, without to much trouble.
MySetup.GET;
MySetup.TESTFIELD("My Default");
MyRecord.RESET;
MYRecord.SETCURENTKEY(Code);
MYRecord.SETRANGE(Code,MySetup."My Default");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 -
Yes, the CONST is good to use just for Option or Boolean fields (sometime for Integer), but never for Code or Text (except if you want filter empty value)- in this case use some setup table...0
-
CONST is for static filters, where no matter what, this field must always have this particular value.
FILTER is for dynamic filters, where the value of a certain field depends on the value of a related field in another table.
Take a look at the form link between the sales header and the sales line in the order forms. The document type has a static filter (CONST) on the required document type, and the document number has a dynamic filter (FILTER), where the Document number of the header record equals the document number of the line records.0 -
The link between a form and a subform is done with FIELD; not FILTER or am I missing something :?
The link for the document no. is set in the SubFormLink; the Document type is set in the subform with the SourceTableView
Navision uses FILTER for this, not CONST
I don;t know why actualy, I remember experimenting with it a long time ago but I don;t remember the outcome.0 -
Mark Brummel wrote:The link between a form and a subform is done with FIELD; not FILTER or am I missing something :?
The link for the document no. is set in the SubFormLink; the Document type is set in the subform with the SourceTableView
Navision uses FILTER for this, not CONST
I don;t know why actualy, I remember experimenting with it a long time ago but I don;t remember the outcome.
I agree but he is following an example that says use the CONST, a bad practice for 'ADM', but ok for "Document Type"=CONST("Document Type"::Order), or MyFlag=CONST(TRUE).
Not a good training example to follow, maybe someone can point him in the direction of better training material.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 -
David Cox wrote:--- SNIP ---
Not a good training example to follow, maybe someone can point him in the direction of better training material.
I use the Navision Programming I and II training guide from "Navision – PC&C Personal Computing and Communications Vertriebs GmbH, Hamburg". It is an official training guide for 5 day Navision Programming Seminar. *g*
Although, that´s no indicator about the quality. My main problem with this guide are the solution-examples. Each lesson had a example how to solve. but they only write "do this and then do that". no word, WHY I should use that certain value or code-snippet. so I can only learn how things happen but not why they happen. for the example on top of this thread it seems to make no difference if i use "CONST" or "FILTER", and there´s no explaination why there´s "CONST" and not "FILTER". Perhaps it´s my problem, that at the seminar, the whole guide is moderated by a trainer and actually I read it for myself and try to understand ...
If anyone know training guides better suitable, please fell free to post a link or send me an pn.0 -
*oops* :oops:
You're right I was wrong..... obviously you don't use FILTER for dynamic linking. I was going off the top of my head, when I am programming this type of stuff I don't even read the property values anymore, I just click them. In my head I call it a FILTER, but it's a FIELD link, and it's not in the SourceTable property. I just wanted to illustrate the difference, and I may have confused Guybrush even more...
I guess the difference between CONST and FILTER is that with CONST you can enter one value, and with FILTER you can enter a filter string. If you want to know more about this, read what F1 help says about it, or go into the C/SIDE Reference guide and search for the property.
Sorry about the confusion, I was rushing, I should take more time for posts like this.0 -
Unfortunately, the help text is not at all helpful and says nothing about why you may select one or the other, C/SIDE reference guide does not even have CONST listed. Good huh?Experience is what you get when you hoped to get money0
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