Assigning rows affected to vaiiable

Discuss RoboTask here
Post Reply
deesloop
Posts: 70
Joined: Wed Feb 25, 2009 3:44 am

Assigning rows affected to vaiiable

Post by deesloop »

I must be missing something on the syntax of this.
I've a variable - I've ticked the Assign "rows affected" into Variable and entered {COUNTBEFORE}, which a step sets to zero initially.
Next step is to run the SQL SELECT ID FROM Ages which in SQL generate 600 rows or so.
I've ticked the Assign "rows affected into Variable" and entered {COUNTBEFORE} as the variable
Subsequent step is a message box to display the value of {COUNTBEFORE} however it is always zero.
If I change the initial setting of the value to 9999, {COUNTBEFORE} Is returned as 9999.

if I change the "Assign "rows affected" into Variable" and entered COUNTBEFORE without {}
I get an error of -1 which I presume is right.

It seems that either my SQL isn't correct (althought my syntax to update SQL is fine)
The value isn't being assigned to the variable.

Any help please?
Oleg
Site Admin
Posts: 3004
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Assigning rows affected to vaiiable

Post by Oleg »

I think that Rows Affected doesn't work with SQL SELECT
Usually this parameter used in queries like INSERT, DELETE, UPDATE

If you want to count rows use SQL group functions
The query
SELECT count(*) FROM Ages
returns only 1 row with 1 field. The value contains the number of rows.
Of course, you have to use Dataset loop to read this value
Oleg Yershov
Post Reply