51Testing软件测试论坛

标题: WinRunner: ddt_add_row [打印本页]

作者: pcl2004_27    时间: 2006-10-25 13:39
标题: WinRunner: ddt_add_row
Description

      Adds a new row under the last in a datatable.


Solution

      Often you need to add a new row to an open datatable.

If your datatable has 1 row and you want to write new values to row 2,
ddt_set_row(table, 2);
will return an error -10005 E_OUT_OF_RANGE

You can do it like this..

ddt_get_row_count(table, row_tot);
ddt_set_val_by_row(table, row_tot + 1, existing_column, "place_holder");
ddt_set_row(table, row_tot + 1);
...

Or
create your own 'ddt_add_row' function...

public function ddt_add_row(in table, in existing_column)
{
auto row_tot;

ddt_get_row_count(table, row_tot);
ddt_set_val_by_row(table, row_tot + 1, existing_column, "place_holder");
return(ddt_set_row(table, row_tot + 1));

}

function use example:
st=ddt_add_row(table_fx, "NZD_GBP");




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2