Highlighted
Absent Member.
Absent Member.
1755 views

LoadRunner ODBC protocol - saving GRID data dynamically

How do I save the value of a specific column for each row when the number of rows returned by the lrd_stmt is not known in advance?

My script looks something like this:

lrd_stmt(Csr17, "select sql, sql...);
lr_bind_cols(Csr17, BCInfo_D118, 0);
lrd_save_col(Csr17,11,1,0,"GUID");
lrd_fetch(Csr17, -4, 1, &rows, PrintRow24, 0);
GRID(24);

I need to get the value of column 11 for each of the rows but the lrd_save_col() doesn't work AFTER the lrd_fetch has executed and BEFORE I don't know how many rows will be returned. For example:

lrd_save_col(Csr17,11,1,0,"GUID");
lrd_save_col(Csr17,11,2,0,"GUID_2");
lrd_save_col(Csr17,11,3,0,"GUID_3");
lrd_save_col(Csr17,11,4,0,"GUID_4");
lrd_fetch(Csr17, -4, 1, &rows, PrintRow24, 0);

The above wouldn't work because I may only get 2 rows returned or maybe 5 or more.

For each of the rows returned by the above query, a subsequent query based on the value of column 11 is executed which is why I'd like to get those values 'upfront', hoping that I could create a loop executing the subsequent queries while(rows>0).

Does anyone know if this can be done and, if so, how?
0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

Re: LoadRunner ODBC protocol - saving GRID data dynamically

U can use variable uliFetchedRows, which contains count of number of rows fetches(in case of negative rows are specified to fetch)
0 Likes
Highlighted
Valued Contributor.. Valued Contributor..
Valued Contributor..

Re: LoadRunner ODBC protocol - saving GRID data dynamically

actually, uliFetchedRows is retrieved inside the fetch itself, in our case fetching all the rows (since we need to determine how many of them there are)

 

Therefore, there is no possibility to use this number as an index for a following lrd_save_col+fetch

 

other ideas?

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.