find as you type code

vasilis6669
Member Posts: 109
Hi,
1) Can someone explain how to implement find as you type in a form search criteria.
For example, I have the customer search field and i want to search for all customers containing the word 'george'
i used setfilter(fieldname,searchvalue) and it only returns exact match. i want the program to return results of %george%
2) How can i display unique values of a column in a drop down list from a table?
Thanks,
Vasilis
1) Can someone explain how to implement find as you type in a form search criteria.
For example, I have the customer search field and i want to search for all customers containing the word 'george'
i used setfilter(fieldname,searchvalue) and it only returns exact match. i want the program to return results of %george%
2) How can i display unique values of a column in a drop down list from a table?
Thanks,
Vasilis
0
Comments
-
1) SETFILTER(Fieldname,'*@' + searchvalue + '*')
2) a drop down list is populated at design time, so you can't use the values of fields in a drop down list (= option field)No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0 -
Hi,
2) for example post code has another column names city name. Do i have to create another table to store city names to be able to display them in an option field?
Thanks,
Vasilis0 -
vasilis6669 wrote:Hi,
2) for example post code has another column names city name. Do i have to create another table to store city names to be able to display them in an option field?
Thanks,
Vasilis
If you want to show unique values for a field in a lookup form, you have to program it yourself. When someone hits F6 in the field, you read the table and put all unique values in a temptable. This table you can then show in your form to have the user select a value.
This is +- the code (example on City of table Post Code):recPostCode.RESET; IF recPostCode.FINDSET THEN REPEAT CLEAR(tmpSomeTT); tmpSomeTT.City := recPostCode.City; IF tmpSomeTT.INSERT(FALSE) THEN ; // if a value exists, it will not give an error on the insert UNTIL recPostCode.NEXT = 0; IF tmpSomeTT.FINDFIRST THEN ; // position on first record IF FORM.RUNMODAL(FORM::"Your Form on TT",tmpSomeTT) = ACTION::LOOKUPOK THEN City := tmpSomeTT.City;
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Can you define the variable name tmpSomeTT?
Alos, in which part of the form i add this code?
Thanks,
Vasilis0 -
-"tmpSomeTT" is the table you need (existing or new [no need to put in license because you only use it as a temptable]) to use as a temptable. In my example with City, you would only need a temptable with 1 field : City:Text50.
-Where to put the code: Again in my example: you would put that code in the OnLookup-trigger of each City-field where you want that functionality. Best put it in the table, not in the form.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Hi,
I create a new table named tmpCity with a column city text 50.
Then on the lookup of the form I added the code mentioned above.
Now on the new form i added a text field with sourceExpr CityFilter(text 50)
on the table relation i used tmpCity. When i compile and run the form i cannot select from the list.
Can you assume what i am doing wrong?
Thanks,
Vasilis0 -
-"tmpCity" is the name of the variable you need. It is for a record on table "City" and you use it as temptable (you need to put the property temptable on the variable).
-field CityFilter: you need to put the code in the OnLookup-trigger of the field.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!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