Hi all,
Today I am writing this post to tell you guys how you can implement Search functionality on a field of a form.
I have taken ProjTable form in AOT and customized it.
You can see a string field on the top of this form with Label : "Search Name".The text typed in this field is used to filter data in the "Name" column of this form.
So, Let's begin by adding a string edit control in the header of this form.
In the class declaration method of this form add the following code:
QueryBuildRange nameRange;
Name nameFilter;
I have declared a QuerybuildRange variable which I would be adding a range in the 'init' method of the datasource(ProjTable).
Now, we will override 3 methods of the StringEdit control on the form.
1) 'enter' method:
public void enter()
{
super();
this.setSelection(strlen(this.text()),strlen(this.text()));
}
It just selects the text written in the text field.
2) 'modified' method:
public boolean modified()
{
boolean ret;
ret = super();
nameFilter = '*'+this.text()+'*';
projtable_ds.executeQuery();
return ret;
}
Execute the datasource query and store the field text in a variable(nameFilter).
3) 'textChange' method:
public void textChange()
{
super();
this.modified();
}
Just call the modified method every time the text changes.
Final step is to override the 'executequery' method of the datasource and provide a value to the range on 'Name' column.
void executeQuery()
{
nameRange.value(nameFilter);
super();
}
It will work like this..
That's it.
Happy Daxing :)
Today I am writing this post to tell you guys how you can implement Search functionality on a field of a form.
I have taken ProjTable form in AOT and customized it.
You can see a string field on the top of this form with Label : "Search Name".The text typed in this field is used to filter data in the "Name" column of this form.
So, Let's begin by adding a string edit control in the header of this form.
In the class declaration method of this form add the following code:
QueryBuildRange nameRange;
Name nameFilter;
I have declared a QuerybuildRange variable which I would be adding a range in the 'init' method of the datasource(ProjTable).
1) 'enter' method:
public void enter()
{
super();
this.setSelection(strlen(this.text()),strlen(this.text()));
}
It just selects the text written in the text field.
2) 'modified' method:
public boolean modified()
{
boolean ret;
ret = super();
nameFilter = '*'+this.text()+'*';
projtable_ds.executeQuery();
return ret;
}
Execute the datasource query and store the field text in a variable(nameFilter).
3) 'textChange' method:
public void textChange()
{
super();
this.modified();
}
Just call the modified method every time the text changes.
Final step is to override the 'executequery' method of the datasource and provide a value to the range on 'Name' column.
void executeQuery()
{
nameRange.value(nameFilter);
super();
}
It will work like this..
That's it.
Happy Daxing :)
Nice information, valuable and excellent in Job, as share good stuff with good ideas and concepts, lots of great information and inspiration, both of which I need, thanks to offer such a helpful information here.mobile phone repair in Auburn Hills
ReplyDeleteiphone repair in Auburn Hills
cell phone repair in Auburn Hills
tablet repair in Auburn Hills
ipad repair in Auburn Hills
mobile phone repair Auburn Hills
iphone repair Auburn Hills
cell phone repair Auburn Hills
phone repair Auburn Hills
tablet repair Auburn Hills
cheap hidden cameras
ismartalarm camera
dymo label maker
Waterproof Action Camera
Coleman full size air mattress
womens cotton long johns
APPLE WATCH SERIES 3 INFORMATION
Winter Cycling Jackets For Men