Data Window
The Data Window loads the data of objects selected to browse in the Data Source Explorer. If you open an object in read-only mode, you cannot make any changes to the object. An asterisk before the object name on the data window tab indicates the presence of pending changes.
Display Tasks
You can perform the following tasks in either read-only or edit mode.
Rearrange the Columns
Select a column and drag-and-drop the column at the required position in the grid.
Sort the Columns
Click a column heading to sort the records in ascending or descending order. When the column is in ascending order, a small triangle appears on top of the column heading. For descending order, an inverted triangle appears on top of the column heading.
View Column Properties
You can view properties associated with an object that is open in browse or edit mode. To view the properties, right-click on a column heading and select Column Properties. The properties of the selected column are displayed in the Properties window.
Search for a Record
Type the record string in the filter area of the Data Window. The matching records appear in the grid view as you type.
Editing Tasks
You can perform the following tasks only when in edit mode.
Add a Row
Follow these steps:
-
Right-click anywhere on the grid area of the Data Window and click Add Row.
-
Enter the number of rows you want to add in the Add Row dialog and click OK. The default value is 1.
The recommended range for adding rows is 1 through 100. -
The selected number of rows are added at the end of the table in Data Window.
The newly added rows have default values depending upon the data type of the column. The default values of a column are assigned according to DB2 data type rules. You can also add a row using the <ADD ROW> option displayed at the end of the table.
Copy a Row
Follow these steps:
-
Right-click on a row and click Copy Row.
A dialog appears. -
Enter the number of times to add the row in the dialog and click OK. The default value is 1.
The row is added the specified number of times at the end the table.
Update a Row
Follow these steps:
-
Select a record from a row.
The value in the record is highlighted. -
Modify the existing value or enter a new value for the record.
The row update is logged and displayed in the Change Manager.
All the data changes of an object are logged in the Change Manager. These changes are not committed to the database unless specified. You can commit or discard the data changes from Change Manager or Data Window.
Delete a Row
To delete a row, right-click on the row and select Delete. Row deletion is committed to the database automatically.
Manage Data Changes
The Change Manager window displays all the pending change records of an object in a tabular format. Rows with updates pending are marked with a green circle icon. You can commit or roll back the changes of an object from the Change Manager. If there are no pending change, the Change Manager window is not available.
Use filters to display a formatted view of specific DB2 data in the Data window. Specify the filter criteria depending on your the type of data that you want to see and the data type of the columns.
If you do not have permissions to submit a query on an object, use a different SQLID for submitting.
Column Selection
Use the Column Selection section of the Layout-Filter dialog to select the required columns from the object. Only the selected columns are displayed and populated in the Data Window. You cannot move the not-null and primary key columns from the Selected Columns list to the Available Columns list.
Example:
An employee table contains employee number, employee name and salary columns. You can choose only to display employee number and employee name columns in the Data Window.
Follow these steps:
-
Right-click on an object from Data Source Explorer.
-
Select the Browse option.
The Layout-Filter dialog appears. -
(Optional) Select the columns from the Selected Columns list that you do not want to be displayed and click Remove.
The selected columns are moved from the Selection Columns list to the Available Columns list. All the columns of the object are available in the Selected Columns list by default. -
Arrange the columns in an order using the Move Up and Move Down buttons.
When the Data Window is populated with the object's data, the selected columns are displayed in the same order.
After you select and arrange the required columns in an order, specify the other filter criteria.
Where Clause
To receive only records that match the specified criterion, use the Where Clause section of the Filter-Layout dialog. A where clause helps you narrow down the search results of an object.
Example: Specify to return rows only when the employee name is JOHN from an employee table.
Follow these steps:
-
Select the field below the Start Bracket heading and select ( from the drop-down list. The right parenthesis ( specifies the start of the where clause.
-
Click <--SELECT COLUMN--> and select a column from the drop-down list.
-
Click the = field and select an operator depending upon the data type of the column from the drop-down list. The operator depending on the data type of the column. The available operators are:
-
=
Specifies equal. -
<>
Specifies not equal. -
>
Specifies greater than. -
<
Specifies less than. -
<=
Specifies greater than or equal to. -
>=
Specifies less than or equal to. -
LIKE
Specifies like predicate. -
IN
Specifies that a value must be in the form of value1, value2, and so on. -
NOT IN
Specifies that a value is in a group of values. -
IS NULL
Specifies that a value is null. -
IS NOT NULL
Specifies that a value is not null.
-
-
Select the field below the Value heading and enter the field value that you are searching for.
-
Select the field below the End Bracket heading and select ) from the drop-down list. The left parenthesis ) specifies the end of a where clause.
-
(Optional) If you want to specify a where clause for another column, select the field below the Conjunction and select a conjunction, AND or OR.
-
AND
Indicates that a row must meet all the conditions. -
OR
Indicates that a row must meet only one of the conditions.-
Click the + field next to the conjunction column.
A row is added for another Where Clause. -
Repeat the steps 1 through 5 for a column.
-
-
After adding Where Clause for the required columns, specify the other filter criteria.
Order By Clause
Order By is an optional clause that sorts and displays data in a column in ascending or descending order for a SELECT statement.
Follow these steps:
-
Click the Order By pane.
The Order By section appears. -
Select one or more columns from the Available Columns list.
-
Move the selected columns to the Selected Columns list using Add > button.
-
Arrange the selected columns in an order using the Move up and Move down buttons.
-
Select a column name from the Selected Columns list and select ASC for ascending or DESC for descending order.
Modify a Filter
You can modify a filter even after an object's filtered data is populated in the Data Window.
To modify an existing filter, click the modify existing filter icon and update the filter criteria as required.