Toad World® Forums

3.6 Automation Issue > RowCount Variable Name Error

Hello,

I have noticed an issue with the rowcount variable name:

Steps to reproduce >

  1. Add “Select to File” / “Execute Script” / “Select to editor with Results”

  2. Rename the activity

  3. Add “Select to File” / “Execute Script” / “Select to editor with Results” (same type as step 1)

  4. Each of the activities will have the same rowcount variable name causing the error: “File_1_RCOUNT: Variable already exists in current scope of visibility. Please rename your variable.”

I skipped several releases but I know in 3.2 the variable automatically changed when the activity name changed.

To Mr. Dave - Stt:

Thank you for posting in Toad World!

I attempted to reproduce the expected action of the Row Count Variable changing. I didn't see this behavior in 3.6 nor in 3.2.

My reproduction attempt in 3.2

I created an activity and renamed it before creating the second activity

1537.3.2_otherActivity.pngObserve that the row count variable appears to be named the same.

What was notable is that in 3.2, I did not run into the duplicate variable error and the activities executed successfully. However, we now have that check in future releases.

The user can address the error directly by changing the Row Count Variable name to remove the error flag.

Software Associate Developer I,
-Joshua Liong

Joshua,

In reference to your comment:

What was notable is that in 3.2, I did not run into the duplicate variable error and the activities executed successfully. However, we now have that check in future releases.

Perhaps this is why I never noticed the behavior and assumed the variable was being renamed. Would it be possible to automatically update the variable name in future releases? Perhaps the variable number of any new activity could be a count plus 1? Or the variable name incorporates the updated activity name?

Dave,

This is by design. This is true that in 3.2 we initially decided to bind “predefined” variables such as RowCount variable to the activity that introduces them. I believe we even didn’t allow to change variable name. Later it was decided that user should decide on variable names by him/herself. In this case the relationship between activity name and variable name that this activity introduced is lost.

In general, we don’t restrict users in variable naming. E.g., you can create two variables with the same name in Variables activity. Of course, such script will not run producing validation error but in the designer you can do it. Same behavior in case we are discussing. Variable names are duplicated but you have a validation error that prevents script from executing.

Igor.

Igor,

How is adding an activity after renaming any different from adding two activities at once. For example, if I were to add two “select to file” TDP automatically names the first variable File_1_RCOUNT and the second File_2_RCOUNT. Now if I were to add a “select to file” and rename it the second “select to file” no longer automatically updates to File_2_RCOUNT it remains File_1_RCOUNT. I guess my confusion is why does TDP know to change the variable name in the first example but doesn’t in the second? Also, if having duplicate variable names prevents the script from running why is TDP automatically assigning duplicate names?

Naming rules are pretty simple in this case: TDP just takes activity name and adds a suffix - _RCOUNT in this case:

  1. You’ve added Select to File activity; activity default name is File_1; row count variable default name is File_1_RCOUNT;

  2. You’ve renamed File_1 to MySelectToFile; row count variable name remains the same - File_1_RCOUNT.

  3. You’ve added another Select to File activity; activity naming procedure doesn’t detect File_1 name, so it uses it as a default activity name again; row count variable gets default name - File_1_RCOUNT.

I would also like to mention that those default variable names are just suggested names, they are provided for a little bit more convenience.

How critical is it for you to do activity renaming right after dropping it onto designer? I can imagine another user might drop a couple more before starting renaming - in this case there won’t be any conflicts.

Igor.

Igor,

I have been using this product since TDA 2.6 and I can honestly say I have no idea what the row count variable is used for.

How critical is it for you to do activity renaming right after dropping it onto designer? I can imagine another user might drop a couple more before starting renaming - in this case there won’t be any conflicts.

Regardless of how I add the activities there is always a chance that there will be a duplicate variable name caused by TDP. For instance I add 5 activities (rename them) and then realize I needed a 6th. The 6th will always have the same variable name as the 1st and we are back to square one. Perhaps I am a unique user because I do not use this variable but I don’t see why I need to rename both the activity name and this variable name just to try and organize an automation task.

In the end it is just annoying

I’ve created change request QAT-4193 to track this issue.

Igor.

As a power user of TDP and Toad for Oracle Xpert edition, I really think that it’s wasted time to try forcing Toad to check variables just because you rename activity during design.

I use Toad automation designer every day and i have one rule, design the entire script with the defaults names, test it, then rename activities as i wish to make it readable by others.

Rcount variables are very usefull with conditions or log activities !