Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Removing the values from variables for each iteration

This is a discussion on Removing the values from variables for each iteration within the QTP forums, part of the Software Testing category; Hi friends, When using an Excel sheet for input variables, in one row I need the variables to be null and in some other row I need the same variable ...

Go Back   Geeks Talk > Software Testing > QTP
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 3 Weeks Ago
Junior Member
 
Join Date: Oct 2009
Location: India
Posts: 12
Thanks: 3
Thanked 0 Times in 0 Posts
spreadsmiles is on a distinguished road
Removing the values from variables for each iteration

Hi friends,
When using an Excel sheet for input variables,
in one row I need the variables to be null and in some other row I need the same variable to contain some value.
For example, if the excel sheet contains data as follows
eg: A B C D
Row 1: 4 0 1 3
Row 2: 1 2 3

When second row is getting executed, A is still having the value 4 where I need it to be null.

Is there a solution for this other than setting every variable to nothing or null at the start of each iteration? setting each variable to null is some what tedious for me because I have more than 100 variables in my excel sheet. This is very urgent for me. Please respond ASAP if u have an answer. Thanks in advance.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 3 Weeks Ago
Expert Member
 
Join Date: Jun 2008
Posts: 212
Thanks: 6
Thanked 12 Times in 11 Posts
learqtptesting is on a distinguished road
Re: Removing the values from variables for each iteration

Reading your post, i felt that you don't initialize your variable correctly. Below may help:

load your datatable
dim rowa, rowb, rowc, rowd, totrowcount
totrowcount = get your excelsheet row count
for i = 1 to totrowcount
rowa = get your data from row a
rowb = get your data from row b
rowc = get your data from row c
rowd = get your data from row d
do your stuff
set current row to next row
Next
Reply With Quote
The Following User Says Thank You to learqtptesting For This Useful Post:
  #3 (permalink)  
Old 3 Weeks Ago
Junior Member
 
Join Date: Oct 2009
Location: India
Posts: 12
Thanks: 3
Thanked 0 Times in 0 Posts
spreadsmiles is on a distinguished road
Re: Removing the values from variables for each iteration

I am using similar code. I am searching for a method which will be like "Remove.All". I don't remember exactly.
Anyways, Thank you.
Reply With Quote
  #4 (permalink)  
Old 2 Weeks Ago
Expert Member
 
Join Date: Jun 2008
Posts: 212
Thanks: 6
Thanked 12 Times in 11 Posts
learqtptesting is on a distinguished road
Re: Removing the values from variables for each iteration

Interesting! share me the trick after you solve the problem.

In the mean time, can you attach you code and datatable?

Try to set your variable to "Null".

load your datatable
dim rowa, rowb, rowc, rowd, totrowcount
totrowcount = get your excelsheet row count
for i = 1 to totrowcount
if (i = your row want to be null) then
rowa = Null
rowb = Null
rowc = Null
rowd = Null
Else
rowa = get your data from row a
rowb = get your data from row b
rowc = get your data from row c
rowd = get your data from row d

End IF
do your stuff
set current row to next row
Next

Last edited by learqtptesting; 2 Weeks Ago at 08:42 AM.
Reply With Quote
  #5 (permalink)  
Old 2 Weeks Ago
Junior Member
 
Join Date: Oct 2009
Location: India
Posts: 12
Thanks: 3
Thanked 0 Times in 0 Posts
spreadsmiles is on a distinguished road
Re: Removing the values from variables for each iteration

Quote:
Originally Posted by spreadsmiles View Post
Hi friends,
When using an Excel sheet for input variables,
in one row I need the variables to be null and in some other row I need the same variable to contain some value.
For example, if the excel sheet contains data as follows
eg: A B C D
Row 1: 4 0 1 3
Row 2: 1 2 3

When second row is getting executed, A is still having the value 4 where I need it to be null.

Is there a solution for this other than setting every variable to nothing or null at the start of each iteration? setting each variable to null is some what tedious for me because I have more than 100 variables in my excel sheet. This is very urgent for me. Please respond ASAP if u have an answer. Thanks in advance.
Hi learqtptesting,

Thank you for the reply and time. But I dont want to set each variable to null individually. But surely I will post the solution if I find any.. I am still waiting for the solution..
Reply With Quote
  #6 (permalink)  
Old 2 Weeks Ago
Expert Member
 
Join Date: Jun 2008
Posts: 212
Thanks: 6
Thanked 12 Times in 11 Posts
learqtptesting is on a distinguished road
Re: Removing the values from variables for each iteration

Looking forward to see the solution.


Curiousity:
Since you design data and list them in excel,

why don't want your data? Can you just leave the cell blank for the intended row, row 2? or why can you just ignore to data in the row (since you don't need them) and do your stuff you would like to? then do normal stuff at other intended row.
Reply With Quote
Reply

  Geeks Talk > Software Testing > QTP

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Iteration ID of QC vamshiram1981 Quality Center 1 09-22-2008 07:56 AM
Iteration in PL/SQL karthizen Oracle 1 06-09-2008 06:21 AM
Tool for arranging and removing start menu items with ease. JobHelper Geeks Lounge 0 01-15-2008 02:00 PM
Code to stop an iteration JobHelper QTP 7 07-11-2007 04:04 PM
How to load variables and values from external file prasad79 QTP 1 05-02-2007 03:00 PM


All times are GMT -4. The time now is 05:18 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved