Filtering The records in a Form

1)Create a Table Named “FilterDemo” and add some fields like Name, Eid, Salary and Add one Base Enum Like Gender.

2) Enter some Data into  the Table.

3) Create a form Name “FiletrDemoForm”.Drag the FilterDemo Table to the DataSource of the form.

4) Under the Design node of the Form.Create  a New Control àTabàTab Page.

Change the properties of the TabPage Like this

Name:- General

Caption:-General

 5) Now Add a new controlàGrid to the TabPage. Now Drag the Fields Which should Appear in the Form to the Grid control from Data Source.

6) Under the Same Tab Page Add a NewGroup. Under the New Group add a new control called ComboBox. Change the property AutoDeclaration of the comboBox to YES and BaseEnum to Gender.

7) Now the form creation is complete. Now We need to see the filtering the Record.

8) Now Declare the range In the classDeclaration of the form.

 

public class FormRun extends ObjectRun

{

QueryBuildRange range;

}

9) Add a Range in init() method of the DataSource.

public void init()

{

super();

range=this.query().dataSourceNo(1).addRange(fieldNum(FilterDemoTable,Gender));

}

10) Override the executeQuery() method of the DataSource.

public void executeQuery()

{

range.value(ComboBox.valueStr());

super();

}

11) Call the executeQuery method in the SelectionChanged method of the ComboBox.

public int selectionChange()

{

int ret;

ret = super();

FilterDemoTable_ds.executeQuery();

return ret;

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: