Topic Options
#30192 - 06/29/09 04:12 PM Ceil Function
Losman500 Offline
OL Toddler

Registered: 06/12/08
Posts: 42
Loc: New Jersey
A few months back I had an issue with rounding up a number to the next highest whole number. I've been using a function that dleblanc had given me. But I really would like to use the Ceil() function and I can't figure out how.

I know that I can have a custom data selection like this =inttostr(ceil (16.1)) and the result will be 17. But what I cannot figure out is how to use the Ceil function with a variable such as Xmlcount.

I would like to take the total number of iterations and divide them by 10 and store the result on a variable then use the Ceil function to round the result(variable) to the next highest whole number.

Here is my old post RoundUp Function
Any ideas?

Top
#30193 - 06/30/09 08:56 AM Re: Ceil Function
Anonymous
Unregistered


Hi Losman500,

It should look like this:
Code:
 
yourvariable:=inttostr(ceil(xmlcount('/XPath/XPath/etc')/10))
 
Just use the right syntax of the xmlcount(xpath)and it should work.

Regards,

Olivier

Top
#30194 - 06/30/09 10:06 AM Re: Ceil Function
Losman500 Offline
OL Toddler

Registered: 06/12/08
Posts: 42
Loc: New Jersey
Thanks once again Oliver but I'm still having trouble. My sample file has 40 iterations

If I use the following on a custom data selection
Code:
=inttostr(xmlcount('/Root[1]/Detail[1]/LineData')/10)
The result is 4

However if I use this code

Code:
=inttostr(ceil(xmlcount('/Root[1]/Detail[1]/LineData')/10))
I get PTK0024 Unknow operator or not a measure"xmlcount"

If I use it as a PP Talk object such as
Code:
Define (&count, string, '')
&count:=inttostr((xmlcount('/Root[1]/Detail[1]/LineData')/10))
Show &count
I get the same error. Should I use inttofloat at some point?

Top
#30195 - 06/30/09 10:09 AM Re: Ceil Function
Losman500 Offline
OL Toddler

Registered: 06/12/08
Posts: 42
Loc: New Jersey
I got it to work. As a custom data selection

[code]
:=inttostr(ceil(inttofloat(xmlcount('/Root[1]/Detail[1]/LineData')/10)))
[code/]

Thanks for the push

Top