Editing datasets

You can add, modify, remove, import, or export data from a dataset by using the CSV Editor. The working principle of the CSV Editor is similar to that of a spreadsheet.

Before you begin

You must have created a dataset. See Creating a dataset in a workspace.

About this task

In Rational® Functional Tester 9.5.0 or later, you can use the CSV Editor to view and edit data in the dataset. You can also view the datasets in other editors by right-clicking the dataset and selecting the Open With option.

You can perform basic tasks in the CSV Editor by right-clicking any row, column, or cell of the dataset to organize your data in a better way. For example, updating the data in a cell, inserting or deleting rows and columns, or renaming column names.

When you edit the dataset in a CSV Editor, you can use the following keyboard shortcuts to control the cursor selection in the CSV Editor:
  • Tab - To move the cursor control to the next available option.

  • Shift-Tab – To move the cursor control to the previous option.

  • Shift+F10 – To open the context menu from the dataset cell.

Note: You cannot resize the width of rows in the CSV Editor. When you have a large amount of data in a cell, you can right-click the cell and select Copy (or Ctrl+C), and then paste it into a text-editing program to view the content. Alternatively, you can hover the mouse over the cell to view the content.
When you have a CSV file that has data separated from a character, then you can import that CSV file into the dataset. You can select any of the following separator characters from the Configure Dataset window, and the selection can be the separator character that you used in the CSV file:
  • Comma
  • Semicolon
  • Space
  • Tab
  • Other

Consider that you have the data in the CSV file in the following format:

ds_sep_csv

When you import the CSV file in the dataset, and then select the separator value as Semicolon, the data in the dataset is displayed as follows:

sep_char_ds_imported
If you want the data in its original format, that is, a semicolon (;) character to separate the data, then you can choose any other separator value from the Configure Dataset window.
Note: The default separator value is Comma.

Procedure

  1. Double-click the dataset that you want to edit in the Test Navigator.
    The dataset opens in the CSV Editor in a browser.
  2. Perform the following actions to use the options available in the CSV Editor:
    Options Actions
    Find and Replace find and replace icon To find:
    1. Click the Find and Replace icon find and replace icon.
    2. Enter the content that you want to search in the Find field.
    3. Select any or all the following options to find the search content more effectively:
      • Select the Case sensitive check box to search the content that is the exact letter case of the content entered in the Find field.
      • Select the Match entire cell contents check box to search for cells that contain only the characters that you have entered in the Find field.
      • Select the Search using regular expression check box to search the pattern that matches strings.
        For example, to search a cell that contains any number between 0 to 9, do the following:
        1. Enter \d in the Find field.
        2. Select the Search using regular expression check box.
        3. Click Find.
    4. Click Find. If the text is found, the cell containing that text is selected.
    5. Click Find again to find further instances of the search text.

    To find and replace:

    1. Click the Find and Replace icon find and replace icon.
    2. Enter the content that you want to search in the Find field.
    3. Enter the content that you want to replace in the Replace field.
    4. Select any or all the following options to find and replace the content more effectively:
      • Select the Case sensitive check box to find the content that is the exact letter case of the content entered in the Find field.
      • Select the Match entire cell contents check box to find and replace for cells that contain only the characters that you have entered in the Find and Replace fields.
      • Select the Search using regular expression check box to find and replace the pattern that matches strings.
    5. Click Replace to replace the individual instances.
    6. Click Replace All to replace every instance of the content throughout the dataset.
    Undo undo_icon
    1. Click the Undo icon undo_icon.
    2. Select the recent changes from the list that you want to undo, and then click the list.

    The Undo option undoes anything you do in the dataset. The CSV Editor saves the unlimited undo-able action. You can perform the undo action even after you save your changes made to the dataset.

    Redo redo_icon
    1. Click the Redo icon redo_icon.
    2. Select the recent changes from the list that you want to redo, and then click the list.

    The CSV Editor saves the unlimited redo action.

    Import import_icon
    1. Click the Import icon import_icon.
    2. Click Choose File and select the CSV file that you want to import in the Import File dialog box.
      Note: If the CSV file contains test data with Unicode characters in it, you must save the CSV file in UTF-8 format. You can then choose the CSV file and import the test data from the CSV file into the dataset.
    3. Optional. Click Overwrite to add the rows and columns from the selected CSV file from the beginning of the dataset.
    4. Optional. Click Append to add rows and columns from the selected CSV file to the end of the dataset.
    5. Optional. Select the First row contains headers check box if your CSV file contains the header.
    Export export_icon Click the Export icon export_icon to download the dataset as a CSV file.
    Set as current row Right-click any cell in a row and select Set as current row.

    When rows are deleted:

    If you delete any row between row 1 to current row, the current row data is taken from the next row.

    For example, when you set the current row as 6, and then you delete any row between row 1 to row 6, the current row remains at row 6, but the content of row 7 is moved to row 6.

    When rows are inserted:

    If you insert any new row between row 1 to the current row, the current row data is taken from the previous row.

    For example, when you set the current row as 6, and then you insert any row between row 1 to row 6, the current row remains at row 6, but the content of row 5 is moved to row 6.

    Dataset configuration settings configuration_icon In the Configure Dataset window, you can set the separator value, change the row and column settings, and configure the string values in the dataset.
    1. Click the Menu icon menu_icon, and then select the Configure option.

    2. Select any of the separator values that you used in the CSV file.

      The available options are Comma, Semicolon, Space, Tab, and Other. In the CSV file, if you have any other separator characters other than the available options, then you can select the Other option, and then can specify a value.

      For example, if the data in the CSV file is separated by a character #, then select the Other option and enter # in the field.

    3. Configure the following options to change the row and column settings:

      • Column header - Use an up-down control button to increment or decrement the value of the column header.

      • Data start point - Use an up-down control button to increment or decrement the value of the data starting pointer.

      • Current row - Use an up-down control button to increment or decrement the value of the current row.

    4. Configure the following options to change the string values in the dataset:

      • Treat as null - Enter a string value that is to be treated as null when running the test.

      • Treat as empty - Enter a string value that is to be treated as empty when running the test.

        For example, when you run the test and the data 123 in the dataset to be treated as empty, then you can specify 123 in the Treat as empty field.

      • Treat empty text as null - Select this field when you want the dataset that contains any blank cells, and the value of those blank cells to be interpreted as null.

    5. Click Update to apply the changes.

    Discard discard_icon Click the Menu icon menu_icon, and then select Discard to discard the changes made to the dataset.
  3. Click the Save icon save_changes_made_to_dataset to save the changes made to the dataset.

Results

You have edited the dataset.