I see that I got you attention, thnx for everyone's help.
I got solution like that
num = 2.87
this = Truncate(num,1)
print this
Function Truncate(num, decimals)
   this = cstr(num)
   thislong = len(this)
   this = left(this, thislong-decimals)
   Truncate = cdbl(this)
  End Function

To Roman, sometimes when you have many things in your head, it is hard
to get an answer right away. Possibly, I might not be as good as you
are, however, you live -you learn. My knowledge of QTP is 3 months
that I had to get due to company needs. My background is IT totally
different things. So that's why I put question like that. Remarks like
'I only wondering what are they doing in the field' - are not
appropriate. Everyone have bills to pay and sometimes it is not their
options to do so. Seriously, I am not trying to offend you. And before
even writing post, I did research, and mostly everything is round up.
If you look in the code it's long if comapre with Round or
FormatNumbers. I know people whio QTP certified and know nothing much.
However, thank you

On Jun 8, 4:35 pm, Roman Zilber <[email protected]> wrote:
> I know that people come from QA background, I only wondering what are they
> doing in the field. How can you do something in automation if you don't know
> string operations, file manipulations, regular expressions, data types, if
> you don't have experience writing big amount of code. The result of this are
> things like keyword driven frameworks, which doesn't exists outside if qa
> automation field.
> I always worked in QA automation... Maybe if someone decide to work with
> QTP, the good idea will be to start from basic book about 
> programming.http://www.deitel.com/can work for it.
>
> On Mon, Jun 8, 2009 at 4:06 PM, Sreedhar Mallipeddi
> <[email protected]>wrote:
>
>
>
> > ur a dev and now a qtp automation engg...u will feel in that way only...
> > but lot of people in this group started their carrier as manual tester and
> > then slowly they are learning things...
> > understand it...don't think..people in this group ..all...are from dev
> > background...
>
> > Sreedhar
>
> > On Tue, Jun 9, 2009 at 1:29 AM, Roman Zilber <[email protected]> wrote:
>
> >> > Good conversation.. so far..
>
> >> I think this entire thread is one big nonsense. When I learned
> >> Introduction to Programming (with C++), it was one of first tasks, to write
> >> function for rounding numbers... For people who *work *in the industry
> >> such problem supposed not to be a question.
>
> >> On Mon, Jun 8, 2009 at 3:41 PM, Srinivas Pavuluru 
> >> <[email protected]>wrote:
>
> >>> Hi Roman Zilber
>
> >>> You are right instead of truncation, we will see rounded values..
> >>> sreedhar also made  a good point users will know what function to use 
> >>> based
> >>> on their requirements. Good conversation.. so far..
>
> >>> Thanks & Regards
> >>> Sriniavs Pavuluru
>
> >>> On Mon, Jun 8, 2009 at 3:31 PM, Roman Zilber <[email protected]> wrote:
>
> >>>> FormatNumber rounds up the number.
>
> >>>> msgbox formatnumber("2.16",1)
> >>>> ==> 2.2
>
> >>>> On Mon, Jun 8, 2009 at 3:26 PM, Sreedhar Mallipeddi <
> >>>> [email protected]> wrote:
>
> >>>>> Good one...still u can use FormatNumber function in an vbs file or in
> >>>>> qtp...Hope that is more easy..
>
> >>>>> On Tue, Jun 9, 2009 at 12:35 AM, Roman Zilber <[email protected]>wrote:
>
> >>>>>> Ho! Sorry I didn't see about "I do not need rounding up."
>
> >>>>>> Function MyNonRoundUp(num, numOfDec)
> >>>>>>     tmp = 10 ^ numOfDec
> >>>>>>     MyNonRoundUp = INT(num * (tmp))/ tmp
> >>>>>> End Function
>
> >>>>>> msgbox MyNonRoundUp(99.99, 1)
>
> >>>>>>  On Mon, Jun 8, 2009 at 3:00 PM, Roman Zilber <[email protected]>wrote:
>
> >>>>>>> Since this discussion turns to be more and more interesting, here are
> >>>>>>> my 5 cents:
>
> >>>>>>> Function MyRound(num, numOfDec)
> >>>>>>>     tmp = 10 ^ numOfDec
> >>>>>>>     num = num + (5/(tmp * 10))
> >>>>>>>     MyRound = INT(num * (tmp))/ tmp
> >>>>>>> End Function
>
> >>>>>>> msgbox MyRound(33.666, 2)
> >>>>>>> msgbox MyRound(0.555, 2)
> >>>>>>> msgbox MyRound(9.5, 2)
> >>>>>>> msgbox MyRound(8, 2)
>
> >>>>>>> On Mon, Jun 8, 2009 at 2:39 PM, Srinivas Pavuluru <
> >>>>>>> [email protected]> wrote:
>
> >>>>>>>> Some additional info.. from  HP help..
>
> >>>>>>>> Returns the integer portion of a number.
>
> >>>>>>>> Int(number)*Fix(*number*)*
>
> >>>>>>>> The *number* argument can be any valid numeric expression. If *
> >>>>>>>> number* contains Null, *Null* is returned.
> >>>>>>>> Remarks
>
> >>>>>>>> Both *Int* and *Fix* remove the fractional part of *number* and
> >>>>>>>> return the resulting integer value.
>
> >>>>>>>> The difference between *Int* and *Fix* is that if *number* is
> >>>>>>>> negative, *Int* returns the first negative integer less than or
> >>>>>>>> equal to *number,* whereas *Fix* returns the first negative integer
> >>>>>>>> greater than or equal to *number.* For example, *Int* converts -8.4
> >>>>>>>> to -9, and *Fix* converts -8.4 to -8.
>
> >>>>>>>> *Fix(**number**)* is equivalent to:
>
> >>>>>>>> Sgn(*number*) * *Int(*Abs(*number*)*)*
>
> >>>>>>>> The following examples illustrate how the *Int* and *Fix* functions
> >>>>>>>> return integer portions of numbers:
>
> >>>>>>>> MyNumber = *Int(*99.8*)*    ' Returns 99.
> >>>>>>>> MyNumber = *Fix(*99.2*)*    ' Returns 99.
> >>>>>>>> MyNumber = *Int(*-99.8*)*   ' Returns -100.
> >>>>>>>> MyNumber = *Fix(*-99.8*)*   ' Returns -99.
> >>>>>>>> MyNumber = *Int(*-99.2*)*   ' Returns -100.
> >>>>>>>> MyNumber = *Fix(*-99.2*)*   ' Returns -99.
>
> >>>>>>>> Thanks
>
> >>>>>>>> Srinivas Pavuluru
>
> >>>>>>>>   On Mon, Jun 8, 2009 at 2:35 PM, Srinivas Pavuluru <
> >>>>>>>> [email protected]> wrote:
>
> >>>>>>>>> Hope you got the solution..
>
> >>>>>>>>> On Mon, Jun 8, 2009 at 2:33 PM, Srinivas Pavuluru <
> >>>>>>>>> [email protected]> wrote:
>
> >>>>>>>>>> Hi
>
> >>>>>>>>>> To get only numbers i mean integer values
>
> >>>>>>>>>> you can use
>
> >>>>>>>>>> mvalue = "2.12"
> >>>>>>>>>> msgbox INT(mvalue)
>
> >>>>>>>>>> alwyas gives you the number
>
> >>>>>>>>>> Thanks
> >>>>>>>>>> Srinivas Pavuluru
>
> >>>>>>>>>>  On Mon, Jun 8, 2009 at 2:29 PM, Srinivas Pavuluru <
> >>>>>>>>>> [email protected]> wrote:
>
> >>>>>>>>>>> Hi
>
> >>>>>>>>>>> you can also try following logic
>
> >>>>>>>>>>> mvalue = "2.12"
> >>>>>>>>>>> mvaluelen = len(mvalue)
> >>>>>>>>>>> mactvalue = left(mvalue,mvaluelen-1)
> >>>>>>>>>>> msgbox mactvalue
>
> >>>>>>>>>>> Thanks
> >>>>>>>>>>> Srinivas Pavuluru
>
> >>>>>>>>>>> On Mon, Jun 8, 2009 at 2:23 PM, Sreedhar Mallipeddi <
> >>>>>>>>>>> [email protected]> wrote:
>
> >>>>>>>>>>>> hi
>
> >>>>>>>>>>>> use formatnumber("2.12",1) , it will give u the excepted result.
> >>>>>>>>>>>> Replace 2.12 with ur value...
>
> >>>>>>>>>>>> Thanks,
> >>>>>>>>>>>> Sreedhar
>
> >>>>>>>>>>>> On Mon, Jun 8, 2009 at 10:30 PM, denka 
> >>>>>>>>>>>> <[email protected]>wrote:
>
> >>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>> tried to search, did not find anything like that here. Anyways,
> >>>>>>>>>>>>> maybe
> >>>>>>>>>>>>> someone knows.
> >>>>>>>>>>>>> I have numbers with decimals like 2.13 and 2.12. Is there a way
> >>>>>>>>>>>>> to
> >>>>>>>>>>>>> truncate decimals in those numbers? like to be 2.1. I do not
> >>>>>>>>>>>>> need
> >>>>>>>>>>>>> rounding up. Thank you in advance
>
> >>>>>>>>>>>> --
> >>>>>>>>>>>> Mallipeddi Sreedhar
> >>>>>>>>>>>> 91-9848871279
>
> >>>>> --
> >>>>> Mallipeddi Sreedhar
> >>>>> 91-9848871279
>
> > --
> > Mallipeddi Sreedhar
> > 91-9848871279- Hide quoted text -
>
> - Show quoted text -

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to