Micro Focus QTP (UFT) Forums
How to set a value for a null value in a function in QTP - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: How to set a value for a null value in a function in QTP (/Thread-How-to-set-a-value-for-a-null-value-in-a-function-in-QTP)



How to set a value for a null value in a function in QTP - galstar - 09-06-2010

Hi,

Please help to resolve the following issue..It's urgent..


I have a function for connectivity to DB.Now for result of some query there is now row in table in DB .so for that while returning value QTP shows error ...
Can i set there any default value so that no error get populate..not in DB i want to set a variable while returning value if no result found...if it can be done then plz give me the idea...


Thanks,
Galstar


RE: How to set a value for a null value in a function in QTP - jsknight1969 - 09-08-2010

Assuming you are using a recordset. You probably need to do this:
Code:
if RS.bof then
'no records
else
'do something
end if

Database queries (recordset) return a BOF (beginning of file) if there are no rows.

Hope that helps.