Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converstion seconds to string

Status
Not open for further replies.

Flal

Technical User
Feb 12, 2002
10
0
0
NL
Hi all,

I have several objects which are amount of seconds... I would like to display them as a string with this format : "HH:mm:ss"

(for example : 45s -> 00:00:45
95s -> 00:01:35, etc...)

For the moment, I define a new variable for each object with a complex combination of &quot;format number&quot; and &quot;truncate&quot;. I would like to create my own function to display my objects like I want (Cell formula would be like that : =MyFormat(<MyObject>)

My question is : Is it possible to create your own function in Business Objects ? If not, do you have any idea of how I could solve my prob ?

Thx for your answers...


Flal
 
I think you can use the format cell functionality and change the format to hh:mm:ss or mm:ss by selecting the date format.
 
Thank you for your answer, but that doesn't work... (Or I didn't manage to make it work...)
 
The formatting bosavvy suggests works only with data that comes in as a timestamp (combination of date with time) or as an actual time-field.
You cannot use it to reformat a string like '45s'

There is certainly a solution possible with a complex universe object using CASE or DECODE to reformat a string like '45s' to a format like '00:00:45'.

If you need the actual code let me know what database you are on and I'll work out the actual code for you.

I an not that familiar with writing ones own BO functions if at all possible. Anyway, a universe solution works generically.......

T. Blom
Information analyst
tbl@shimano-eu.com
 
Thank you, but I already have the formula... What I would do is creating a function to repeat this formula on each objects I need...

Thank you for your help...
 
You misunderstand me, I am referring to an universe object, not to using formulae within the reports.

Universe objects are generic, you can reuse them for every report, cause they are used on the SQL level (the statement that fetches data from the database)

So, with an universe object the reformatting is done at the database level and brought in with the SQL output.....

No need to do anything anymore within the report...

T. Blom
Information analyst
tbl@shimano-eu.com
 
Yes, I understand you... But I have to use this formula with several objects. So, in the universe, I have to create a lot of objects with this formula... I was just looking for an easy way to do it, without rewriting it for every objects...
 
Flal,

I do not know how to add functionality to Business Objects reporter, other than VBA. However, functionality can be added to designer.

In folder Data Access 5.0 find your Database folder and open a *.PRM file. Here you will find the ability to create functions to be used in designer to build opbjects that return the format that your report needs.

+++++++ S N I P +++++++++++++++
Code:
[FUNCTIONS]
(0)
NAME= Substring
TRAD= String: $Initial position: $Number of characters:
HELP= Extracts a sequence of characters from a character string
TYPE=A
IN_MACRO=Y
GROUP=N
SQL=substring($A,$n,$n)
++++++++++++ S N I P +++++++++++

 
Thnk you, I will try this...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top