Conversion of Numbers to Characters

Hi,

I’m a new Business Objects person and am slowly getting to grips with it.

I have a question which I hope someone may be able to answer for me.

As a footer to a standard report, I wish to include the text “Page n of M”.

Currently, I have this defined as

=Concatenation("Page “,Concatenation(Concatenation(Page(),” o f "), NumberOfPages()))

this fails with a “Incorrect Data Type” message. I presume this is because the result of both Page() and NumberofPages() is a number, whilst the Concatenation(,) function expects two strings.

How can I convert/cast Page() and NumberofPages() to being a character string?

Cheers
Jane

(______ <-/> __)
/
.-=-.| " |/.-=-.

/
(o_o)/
/
// ^ /\
/ | / \ | /
/((( )))
\ _/ /

(((—’ '—)))

======================
= Jane Fothergill =
= GMRPS IS =
= Tel: 0181 966 2554 =
= Fax: 0181 966 2109 =

======================


Listserv Archives (BOB member since 2002-06-25)

In a message dated 98-08-15 16:33:03 EDT, you write:

How can I convert/cast Page() and NumberofPages() to being a character
string?

Cheers
Jane

Use this formula instead:

= "Page " + Page() + " of " + NumberOfPages

The + seems to do an automatic conversion from number to character, while the Concatenation() function does not. Another side note: instead of using the Concatenation() function, simply use the & character. As in:

= &

or

= & ", " &

It is much more clear, and does not require the depth of nesting that the Concatenation() function does.

If you do mix data types using Character and Date, you use the FormatDate() function to translate dates to character strings. If the “plus” trick that I showed previous did not work, you would have to use FormatNumber() to translate the number to a character.

Regards,
Dave Rathbun
Integra Solutions
www.islink.com


Listserv Archives (BOB member since 2002-06-25)

Hello !

Well there are multiple answer to your question.
The first one, does not need any convertion.
If you want to have as a footer the sentence “Page # of #”, just follow those instructions:

  1. Open your report
  2. Click on “View” then “Page Layout”

Now you can see the header section and the footer section

  1. Now click on “Insert”
  2. Select “Special Field”
  3. Select “Page Numbers”
  4. Select “Page # of #”

Now you just have to put this field directly on your report in the Footer section.

Now if you want to create this field manually, you can use the formula wrote before:

=> ="Page "+ Page() + " of " + NumberOfPages

But if you really want to use the concatenation function, you need as you know to convert the number into a string.
To do that, you just have to use the FormatNumber function.
This function returns a string
for example you can use it like this :

FormatNumber(Page(), “###”);

using that, if Page() returns 2 you will have 2, the “###” means that it will return your number as string for Page() values from 0 to 999.

I hope it will help you

Cédric Paumard

DeskI & WebI Developer
BI Toolkit - Offices in UK and Holland
http://www.bitoolkit.com


[bitk]Cedric (BOB member since 2008-03-10)

Cédric, that’s a nicely described solution, but I doubt the person is still waiting for a solution after posting nearly 10 years ago :blue: .


Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

Well, I hadn’t read the date, I just answered the question !
And this answer could also help someone, who has the same problem.
It is never a waste of time to answer a question which has no real answer.

By the way, it is my point of view.

Best regards,

Cédric Paumard

DeskI & WebI Developer
BI Toolkit - Offices in UK and Holland
http://www.bitoolkit.com


[bitk]Cedric (BOB member since 2008-03-10)

[quote:8ed3c48b7e="[bitk]Cedric"]And this answer could also help someone, who has the same problem.
[/quote]

Indeed!


Dwayne Hoffpauir :us: (BOB member since 2002-09-19)