How search a value (I don't know the row and column)

Hello everyone,
How search a value (I don’t know the row and column) into the result query.
My result query is like this:

I want to know if D80 exist in the result ${q_result}
I tried to use " Check Query Result @{q_result} contains D80" but I have an error
image

Thx

Hi,

The query result is a list containing a tuple.
List is a list of corresponding rows (here just one), then tuple contains row columns infos.

So you can’t pass the result to the Check Query Results.

This keyword required to pass the query directly:

Check Query Results    SELECT * FROM....   contains   D80

But seems a bit strange to search a value that query already tried to get?

If you want to use directly ${q_result} (do the query then check content) , you could use Evaluate:

 ${hasValue}    Evaluate   "D80" in ${q_result}

This is a quick example, you will probably have to managed multilines results/lists and loop over uncompressed tuples to manage all cases and q_result format.

Regards
Charlie

Wouldn’t just simple count do in this case ? If the original SQL query has WHERE c_prot = 'D80' then the query wont return any rows if c_prot is not D80 and thus it is quaranteed to have that value on each row returned by the query ?

1 Like

Yeah totally, that’s why I mention the Select that already search for D80.
A count is a fast solution to know if present, and will return occurrences as a bonus.
Nice!

Thx Everyone for your reply.

I put D80 in “where and search” for the example, Sorry it’s stupide :face_with_peeking_eye:

I filter with D80 and I can have one or more rows.
Then, I search for values ​​without specifying the columns, just to quickly check if my values ​​are up to date.

I could count the columns and rows and then loop, but I’m looking for a simple and quick solution.
Thanks again.

Hi @CharlieScene
“Evaluate and Check Query Result” don’t work.

I think I’ll have to create a loop.
However, I can give it the column name; maybe that might help ?

Have a nice day

How search a value (I don’t know the row and column) · Issue #241 · MarketSquare/Robotframework-Database-Library