Posted by Albert Gareev on Jan 14, 2008
Parent page: Service Functions – Math (QTP, VBScript) Description Sorts one-dimentional array in ascending / descending order with typecasting. Implementation Public Function TypedArraySort(ByRef dvArray, ByVal sFormat, ByVal boolAscending) Dim Iter, Jter, aValue, boolRC If Not isArray(dvArray) Then dvArray = Array(dvArray) ArraySort = dvArray End If sFormat = UCase(sFormat) [...] ...
Posted by Albert Gareev on Jan 12, 2008
Parent page: Service Functions – Math (QTP, VBScript) Description Sorts one-dimentional array in ascending / descending order. Implementation Public Function ArraySort(ByRef dvArray, ByVal boolAscending) Dim Iter, Jter, aValue If Not isArray(dvArray) Then dvArray = Array(dvArray) ArraySort = dvArray End If For Jter = 0 To UBound(dvArray) For Iter = [...] ...
Posted by Albert Gareev on Apr 25, 2007
Math primitives In the code examples I present I often refer to routine functions. In my framework I have specialized libraries to call from. In my blog I maintain the similar structure. Math primitives 1 (WinRunner, TSL) Absolute value (Modulus) Check if a value has a multiple Check if a value belongs to range Check if [...] ...
Posted by Albert Gareev on Apr 23, 2007
Service Functions – Math / WinRunner Find and retrieve subrange, defined by RegEx public function mx_subrange_regex(inout mxTable[], inout mxRange[], in regex_from_str, in regex_to_str, in regex_col, in flExtend, in start_row, in end_row) { auto rc, i, j, row_index; auto col_count, row_count; auto flFound; col_count = mxTable[0, "sys", "colCount"]; row_count = mxTable[0, "sys", ...
Posted by Albert Gareev on Apr 21, 2007
Service Functions – Math / WinRunner Add new column to a matrix public function mx_add_col_value(inout mxTable[], in col_value) { auto rc, i; auto col_count, row_count; col_count = mxTable[0, "sys", "colCount"]; row_count = mxTable[0, "sys", "rowCount"]; # create new col index col_count++; for (i=1;i<=row_count;i++) mxTable[i,col_count] = col_value; mxTable[0, ...
Posted by Albert Gareev on Apr 19, 2007
Service Functions – Math / WinRunner Convert matrix to text table public function mx_array_2_table(inout mxTable[], inout dtTable[], in separator, in skip_empty) { auto col_count, row_count, i,j; auto row, s_value; if (skip_empty != TRUE) skip_empty = FALSE; if (separator == "") separator = "\t"; col_count = mxTable[0, "sys", "colCount"]; row_count = mxTable[0, "sys", ...
Posted by Albert Gareev on Apr 17, 2007
Service Functions – Math / WinRunner Check a value exists in array public function mx_val_exists(in value, inout dtSet[]) { auto i; for (i in dtSet) if (value == dtSet[i]) return(TRUE); return(FALSE); } Sort one-dimensional array public function mx_sort_vector(inout mxVector[], in flAscending) { auto i,j,c,v; if (flAscending != FALSE) flAscending = TRUE; c = [...] ...
Posted by Albert Gareev on Apr 15, 2007
Service Functions – Math / WinRunner Absolute value (Modulus) public function mx_val_mod(in value) { if (value < 0) return(-1*value); else return(value); } Check if a value has a multiple public function mx_val_multiple(in value1, in value2) { auto k; if (value2 == 0) return(TRUE); k = value1 / value2; return(int(k) == k); } Check if a [...] ...
Posted by Albert Gareev on Feb 22, 2007
How to generate filename with a timestamp Parent page: Service Functions – System (WinRunner, TSL) public function sys_gen_file_name(in format, out fname) { auto t, src, year, date, time; format = toupper(format); if ((format != "DATE") && (format != "TIME") && (format != "DATETIME")) return(E_GENERAL_ERROR); src = time_str(); src = str_replace(src, ":", ...
Posted by Albert Gareev on Feb 21, 2007
In the code examples I present I often refer to routine functions. In my framework I have specialized libraries to call from. In my blog I maintain the similar structure. Create Folder public function sys_mk_dir(in dirpath, in dirname) { auto rc, cmd_line; cmd_line = dirpath & "\\" & dirname; rc = dos_system("MkDir " & "\"" [...] ...