BusinessObjects Board

converting a string to a number

Could someone point out to me how this is done. I have honestly been looking for it but have so far failed to find.
Apologies for the simple question, but it would help me out if someone could answer.

If it helps I am specifically looking to convert the userresponse() to a prompt for year to a number for year…

thanks


icytrue (BOB member since 2006-04-10)

Are you after this?

=ToNumber(UserResponse(<"dp name">,<"prompt string">))

Jansi :india: (BOB member since 2008-05-12)

hmmmm yes thank you, I had just found it myself too.

When I put that formula in a new variable (named y1) it is always a DETAIL for some reason

=ToNumber(UserResponse (“Query 1 with RestServ” , “Enter the First Year”))

and when I then try and do this in another new variable

= Where (=)

it always gives a syntax error DB0007

it is a very simple thing I am trying to do - I would be surprised if there not some way of doing it…

any thoughts?


icytrue (BOB member since 2006-04-10)

Instead of using ‘where’ try using ‘If’, as ‘where’ accepts only constants to be compared. Also check this in FAQ


Jansi :india: (BOB member since 2008-05-12)

I think I have found the answer in the FAQ

the where clause can only refer to fixed values, so you need to create a variable that compares the year to the userresponse - e.g.

=( = ToNumber(UserResponse (“Query 1 with RestServ” , “Enter the First Year”)))

and then you can use where referring to 1 (as the above expression will resolve to 0 or 1). then I can do:

= ( Where (=1))

thanks for your help


icytrue (BOB member since 2006-04-10)