Problem with OnInputChange() Trigger
ajaybabuCh
Member Posts: 208
Hi
I have one text box bounded to the variable 'Search Name' of type Text.
As the user enter the text in the text box I want to filter records.
I can not get the text as the user entered into the Variable 'Search Name'
in OnInputChange Trigger.
I tried the following code to get the text
OnInputChange()
CurrForm.SAVERECORD;
RESET;
REC.SETFILTER(FieldName,SearchName+'*');
Whenever the user enter the single character that will be blocked with blue color.
To enter remaining text I need to click on the control and move the cursor to the end of text then only I can enter the text other wise it will be replaced with new character.
How to get the text entered by the user as it is in the OnIputChange() trigger.
AJAY INDIA.
I have one text box bounded to the variable 'Search Name' of type Text.
As the user enter the text in the text box I want to filter records.
I can not get the text as the user entered into the Variable 'Search Name'
in OnInputChange Trigger.
I tried the following code to get the text
OnInputChange()
CurrForm.SAVERECORD;
RESET;
REC.SETFILTER(FieldName,SearchName+'*');
Whenever the user enter the single character that will be blocked with blue color.
To enter remaining text I need to click on the control and move the cursor to the end of text then only I can enter the text other wise it will be replaced with new character.
How to get the text entered by the user as it is in the OnIputChange() trigger.
AJAY INDIA.
Ajay
0
Comments
-
Use SENDKEYS for that, and send in F2 twice. I don't exactly how to do this, but one of my coworkers got that to work. You should be able to search for sendkeys in this forum.0
-
Hi DenSter,
could your (or others) provide a little more information: I have been asked to make the same functionality, but has problems getting back into the TextBox and let the user continue typing.
I've made the following code:GetKeys is the automation 'Windows Script Host Object Model'.WshShell SearchNameBox is the name of the TextBox SearchName is a Text250 Text1 is a field on the table CurrForm.SAVERECORD; CurrForm.SearchNameBox.ACTIVATE; IF ISCLEAR(GetKeys) THEN CREATE(GetKeys); GetKeys.SendKeys('{F2}{F2}'); RESET; SETFILTER(Text1,searchname+'*');
but it lets me only enter one char!With Kind Regards
Thoms Hviid Thorn0 -
OnInputChange()
CurrForm.SAVERECORD;
RESET;
REC.SETFILTER(FieldName,SearchName+'*');
Just move your first code to the OnAfterValidate trigger of the textbox
OnAfterValidate()
RESET;
REC.SETFILTER(FieldName,STRSUBSTNO('%1%2%3%2','@','*',SearchName));
CurrForm.UPDATE;
The @ means Ignore Case
If that still has problems then create a function on the form and call this!
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 -
Hi David.
the reason to use the OnInputChange was to get the 'Find-As-You-Type'-functionality, as known from the Find (Crtl-B in ENU language).
Below the field the information which is searched in is filtered, so you're immidiate see the result of the filter (without pressing Enter).
... as you all may guess - in Denmark its summertime, and the boss is on holiday ...
With Kind Regards
Thoms Hviid Thorn0 -
Oh yep! :oops:
I did not read the original post correctly!
The text is left selected after entering one value, so find as you type is not working.
Would form or control update or control activate solve it?.
currForm.UPDATE;
currForm.MyControl.UPDATE;
currForm.MyControl.ACTIVATE;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 -
That's ok, David - glad you reacted so fast.
Sorry - no, that still move focus away from the TextBox.
With no luck, I've tried to track down the uppersite SENDKEYS-method.
Guess, I've just have to wait for NAV 5 and Visual Studio ...With Kind Regards
Thoms Hviid Thorn0 -
Are we gonna be beaten by this one?
One last untested Idea, Use a form with the search variable, and a sub form with a form function to filter and update the lines.
On the parent form OnInputChange call the subforms function with the SearchString, and get a customer No. returned, without updateing the parent form!
Duh!! Reverse Gear! this won't work as we need to return a record!
Back to the think tank!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 -
Can't you put the databasefield on the form and make it uneditable. Then when typing in this field you can use the standard search.0
-
OK looks here is a solution I did a while back. I just re did it quickly in 5 min.
I'm sure you can make prettier. It's based on Item record.OBJECT Form 50000 example filter as you type { OBJECT-PROPERTIES { Date=06/28/06; Time=[ 8:29:31 PM]; Modified=Yes; Version List=; } PROPERTIES { Width=9130; Height=6820; TableBoxID=1000000000; SourceTable=Table27; } CONTROLS { { 1000000000;TableBox;220 ;220 ;7920 ;5500 ;HorzGlue=Both; VertGlue=Both; InlineEditing=Yes } { 1000000001;TextBox;0 ;0 ;1700 ;0 ;ParentControl=1000000000; InColumn=Yes; SourceExpr="No." } { 1000000002;Label ;0 ;0 ;0 ;0 ;ParentControl=1000000001; InColumnHeading=Yes } { 1000000003;TextBox;0 ;0 ;4400 ;0 ;HorzGlue=Both; ParentControl=1000000000; InColumn=Yes; SourceExpr=Description } { 1000000004;Label ;0 ;0 ;0 ;0 ;ParentControl=1000000003; InColumnHeading=Yes } { 1000000012;TextBox;2640 ;6050 ;2420 ;440 ;Name=box1; SourceExpr=Searchtxt; OnActivate=BEGIN Searchtxt := searchtemp; END; OnInputChange=BEGIN CurrForm.box2.ACTIVATE; CurrForm.box1.ACTIVATE; END; OnAfterInput=BEGIN Searchtxt += Text; END; OnValidate=BEGIN searchtemp += Searchtxt; SETFILTER("Search Description",'*@'+searchtemp+'*'); END; } { 1000000013;TextBox;5500 ;6050 ;660 ;440 ;Name=box2; Editable=No; SourceExpr=Searchtxt2 } { 1000000014;Label ;440 ;6050 ;1870 ;440 ;CaptionML=ENU=write here } { 1000000005;CommandButton;6600;5940;2310;550; CaptionML=ENU=Clear; OnPush=BEGIN Searchtxt := ''; Searchtxt2 := ''; searchtemp := ''; END; } } CODE { VAR Searchtxt@1000000000 : Text[30]; Searchtxt2@1000000001 : Text[30]; searchtemp@1000000002 : Text[50]; BEGIN END. } }0 -
I added a button to clear it. Again I did in 5 min. It can be improved. I'll make it better.0
-
Hi folks,
No, Find is not good enough - then I wouldn't have asked here!!
By now it's only a prototype, just to try if it can be done (as we want it).
Whether its going to be used or not, will also depend on other issues as performance - which I'll not make a subject here (Others may be welcome though).
- BlackTiger
Do you mind sharing ?I know ONE way how to do this
- ara3n: That about where I/we are heading too.
Thanks for for sharing.With Kind Regards
Thoms Hviid Thorn0 -
BlackTiger, I'm tempted to dare you - but since I haven't got the money to do that, I'll just back off here

OFF-TOPIC:
Every IDE but C/AL got the feature of for programmers (Find-Statements-As-You-Type) - but I guess you find that stupid too :-sEven it's stupid feature
As off my point of view, I stand <beaten> aside David Cox.With Kind Regards
Thoms Hviid Thorn0 -
Hmmm... No. Or for quite good money. Just because it's not realy necessary feature. Even it's stupid feature. And stupid features must to cost alot of money. Also it's not problem of Navision.
Hmmm... Sad day,
If we all took this view this forum would close! [-X
How many questions do we answer, when the soloution is simple, and should be covered by the reseller's training and not us?
How stupid is a trigger called OnInputChange(), where you cannot return the Input, but the help say's ?Even it's stupid featureThe C/AL code in this trigger is executed while the user makes entries into a text box. You can use this trigger to check the entries the user is making as he or she enters information.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 -
Never say dare-it-not to a Coder!! 
Nice work =D>
May I ask how you did it :?:With Kind Regards
Thoms Hviid Thorn0 -
Hopefully v5 will give us more controls of the GUI.0
-
I tried for a while to make this work using standard Navision Code but with no luck.
Like everyone else I can get it to filter and then it comes back to re-activating the field and not being able to continue from the last character entered.
Has anyone else had any luck with C/AL?
BlackTiger, from looking at your video it looks as if this is using "with events" like your other demo?
True? I think that the second version looks much nicer than the first. Good Job. =D>0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 333 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 991 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

