Wednesday, 18 June 2014

CInt(Number) :-Function-->The CInt function will converts any number to the variant of subtype Integer.

Syntax:-CInt(Number)

The CInt function will converts any number to the variant of subtype Integer.
Converts to values ranging from -32,768 to 32,767 The number is rounded off.

Code:

a=1555.567
Cint(a)

Output:
1556

And mostly where we will use . Some time when we get the value from our application, there is the chance to be an variable .
Example recently I get  the value from one label ,its look like integer (E.g 8) but its displayed as variable . so in this situation we need to convert it from variable to integer.

Why we need to change it as integer.

if we need to compare the value to any integer surly we need to convert it before as an integer.
 

FormatDateTime (Date, DateFormat) -Function:-The FormatDateTime function will formats dates and times. The output format is: MM/DD/YYYY

FormatDateTime (Date, DateFormat)

The FormatDateTime function will formats dates and times. The output format is: MM/DD/YYYY
This is one which we are using frequently.

Example:-

a=formatdatetime("06/May/84")
msgbox a

'OutPut is:-5/6/1984

FormatDateTime("15:34")

Output:
6/26/1943
3:34:00 PM

There is one optional argument.
DateFormat
The optional DateFormat argument must use the constant or value from the Date Format CONSTANTS.

Example:-

a=formatdatetime("06/May/84",1)
msgbox a
'OutPut is:-Sunday,May 6,1984
 

Wednesday, 21 May 2014

DateDiff Function :-The DateDiff function will calculates the amount of time between two different dates.

Syntax :-
DateDiff(Interval, Date1, Date2, FirstDayofWeek, FirstWeekofYear)

Example:-

S=Datediff("d","01/May/2014","21/May/2014")
msgbox S
Output=20 (return the day different)

S1=Datediff("m","01/Jan/2014","21/May/2014")
msgbox S1
Output=4 (return the Month different)

S2=Datediff("yyyy","01/May/2013","21/May/2014")
msgbox S2
Output=1 (return the Year different)

S3=Datediff("w","01/May/2014","21/May/2014")
msgbox S3
Output=2 (return the week different)

S4=Datediff("y","01/May/2014","21/May/2014")
msgbox S4
Output=20 (return the day different of the year)

S5=Datediff("h","01/May/2014","21/May/2014")
msgbox S5
Output=480 (return the Hours different of the year)

S6=Datediff("n","01/May/2014","21/May/2014")
msgbox S6
Output=28800 (return the Minutes different of the year)

S7=Datediff("s","01/May/2014","21/May/2014")
msgbox S7
Output=1728000 (return the Seconds different of the year)

Day Function:-The Day function will Returns the day of the Date and Number of the day for that month

Example:-

a=Day(01)
msgbox a
Output=31 (Number of Days)

b=Day("01/May/2014")
msgbox b
Output =1 (Return the Day)

c=Day("01/May")
msgbox c
Output=1 (Return the Day)

a=Day(Date)
msgbox a
Output=21 (Return the current date of the current month as per system date)

Date Function :The Date function will Returns the current date as per your computer system

E.g:-

A=Date()
Msgbox A
or
A=Date
Msgbox A
 

Hi Friends,

Hi Friend after long time I am going to share my Knowledge and I am very happy to be a blogger

If an Experienced person in QTP then he/she should know the VB Scrip In-build function .Surely we may not get chance to use all function but we should know or should store some where .,..here I am storing my knowledge to use later whenever I need... even my friend you people can use my knowledge and I am eagerly waiting for your knowledge sharing. I am mostly welcome to be a part of my blog..
 

Tuesday, 14 January 2014

How to rectify when QTP Menus are not displayed and disappeared ?

Step to rectify the issue.

1.Select QTP Tools menu.
2.Right Click
3. Select "Customize" sub menu.
4. Select "Tool bars" in Customize window.
5. Click "Restore All" button
6. Then Click "Yes" button in confirmation popup.
7.Click on "close" button in customize window..

Now Check all menus will be restored from QTP settings.