GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Testing Tools  >  QTP
Go To First  |  Previous Question  |  Next Question 
 QTP  |  Question 595 of 684    Print  
How to pass a key in the query while creating a database check point?
Hi, Would be great if you could let me know how to pass a key in the query while creating a database check point? My key value is stored in a variable in the script.

In short, what I want to know is:

myVar='keyvalue'

select * from myTable where myKey='keyvalue';

Instead of specifying the query like select * from myTable where myKey='keyvalue'; in the database checkpoint, I want to use the variable myVar so that the 'keyvalue' can be dynamically attributed.
Thanks.




  
Total Answers and Comments: 6 Last Update: April 16, 2008     Asked by: animesh_QTP 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
December 11, 2007 12:23:10   #1  
siteuse Member Since: June 2007   Contribution: 12    

RE: How to pass a key in the query while creating a database check point?
I think we can use parameterization but I am not sure please correct me if i am wrong
 
Is this answer useful? Yes | No
December 20, 2007 12:38:44   #2  
sairam100 Member Since: December 2007   Contribution: 9    

RE: How to pass a key in the query while creating a database check point?

I too have the same question. How can we pass a varible while creating a DB checkpoint. Is it even possible ?


I would like to do something like

QTP script
variablename somevalue

select * from table where col variablename

instead of doing
select * from table where col 123

Thank you
Sairam


 
Is this answer useful? Yes | No
December 26, 2007 21:26:44   #3  
abihari Member Since: December 2007   Contribution: 1    

RE: How to pass a key in the query while creating a database check point?
I don't think it is possible tp parametrize a checkpoint. A db checkpoint says you have a expected set of data (which is obtained only from a query with hard coded values) and this is compared with the run-time query execution(which is dynamic).

I do not know if you did find a solution to the problem you have posted. Do let us know if there is any solution to parametrizing or some other way to go around the problem.

 
Is this answer useful? Yes | No
January 16, 2008 02:06:23   #4  
angiemercy Member Since: January 2006   Contribution: 2    

RE: How to pass a key in the query while creating a database check point?
I would like to do something like

QTP script
variablename somevalue

select * from table where col variablename

instead of doing
select * from table where col 123

Sairam this is quite possible from my experience.
Instead of
variablename somevalue

make it as a function pass the somevalue

like

function func(variablename)
select * from table where col variablename
end function

Call func(somevalue)

it will work....

let me know after trying this.

Good Luck.

 
Is this answer useful? Yes | No
March 26, 2008 05:28:25   #5  
ManjuPillae Member Since: March 2008   Contribution: 20    

RE: How to pass a key in the query while creating a database check point?
'Assume that 'key' values are present 'keyValues' column under the Local datasheet


For ...
...
myVar DataTable("keyValues" dtLocalSheet)
select * from myTable where myKey myVar;
...
Next

In this way we can send new values each iteration and new query will be executed

 
Is this answer useful? Yes | No
April 16, 2008 02:55:29   #6  
sri_yarley Member Since: May 2007   Contribution: 2    

RE: How to pass a key in the query while creating a database check point?

While a database checkpoint is created the select statement gets stored in "Source".

So for parameterizing it Create a checkpoint initially in the normal flow with a constant value.....and then parametrize it by updating with SETTOPROPERTY command as shown below....


a "select * from tablename where colname '" & datatable("colnameinqtp" dtlocalsheet) & "'


dbtable("dbtable").settoproperty "source" a


hope this will help u....


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape