QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
Contributor III

Interval() formatcode

Hi,

I'm using the Interval() function with the format code 'd hh:mm:ss'. The result looks like  6 11:21:33

Is there a way to get 6 days 11 h 21 min 33 sec instead?

Regards,

Florian

Tags (4)
1 Solution

Accepted Solutions
MVP

Re: Interval() formatcode

Yes, by creating a concatenated string with the single items:

=dual(

floor(Interval) &' days ' & hour(Interval) & ' h ' & minute(Interval) & ' min ' & second(Interval) & ' sec'

, Interval

)

5 Replies
MVP

Re: Interval() formatcode

Yes, by creating a concatenated string with the single items:

=dual(

floor(Interval) &' days ' & hour(Interval) & ' h ' & minute(Interval) & ' min ' & second(Interval) & ' sec'

, Interval

)

Not applicable

Re: Interval() formatcode

hi

yes like above post, use & operator for concatenate

MVP

Re: Interval() formatcode

There is no direct format code as of my knowledge.

May be something like this

LOAD Dual(%CustomFormat, RowNo()) AS %CustomFormat Inline [

%CustomFormat

days

h

min

sec];

=Concat(Aggr(Subfield(Interval(dateField, 'd|hh|mm|ss'), '|') & ' ' & %CustomFormat, %CustomFormat),' ',%CustomFormat)

OR

=Subfield(Interval(dateField, 'd|hh|mm|ss'), '|', 1) & ' days ' & Subfield(Interval(dateField, 'd|hh|mm|ss'), '|', 2) & ' h ' & Subfield(Interval(dateField, 'd|hh|mm|ss'), '|', 3) & ' min ' & Subfield(Interval(dateField, 'd|hh|mm|ss'), '|', 4) & ' sec'

Contributor III

Re: Interval() formatcode

Thanks! As there is no proper formatcode, swuehls approach seems to be the simplest alternative ...

Not applicable

Re: Interval() formatcode

Hi Swuehl,

Thanks for your easy wayaround to this problem.How ever I was wondering what is the need of 'Dual' here.Please explain and enlighten me.

Many thanks

Regards

Murali Krishna