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?
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.
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:
Open your report
Click on “View” then “Page Layout”
Now you can see the header section and the footer section
Now click on “Insert”
Select “Special Field”
Select “Page Numbers”
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.
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.