Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Partner
Partner

Timeformat

I am stuck with a problem concerning times

I have two different end times

I need to test if first endtime lays behind second end time and then need to adjust it

so e.g. my first end time is 10:00, my second end time is 17:00

i read these Dates from a table using peek and store in variable

in script I define if (vtend > vwend, vtend=vwend)

with by times of 10:: as first end and 17:00 as second end, the condition Returns true

in a TextBox with this Expression (for test purposes)

=if (time(vTEnd,'hh:mm')<time(vWEnd,'hh:mm'),1,0) & '-' & vTEnd & '-' &vWEnd

I get this result

where do I stuck?

3 Replies
MVP & Luminary
MVP & Luminary

Re: Timeformat

Do your variables contain real time values? In other words should you use time() or time#().

And you can get rid of the if using the rangemin function: rangemin(vtend, vwend) as vtend


talk is cheap, supply exceeds demand
Partner
Partner

Re: Timeformat

good suggestion, I give rangemin a  try

Partner
Partner

Re: Timeformat

curious Thing:

one endtime was derived from a date/time Format (like YYYYMMDD hh:mm:ss). I made a dozen of different formatting but didnot suceed (every Option I choosed, the TextBox showed the correct timeformat - and i only Need timeformat).

I got a hint, when I changed  the Format to num and was very much surprised that it gave me a huge number (something 42000) which should be the date. So even if I formatted to time(myfield,'hh:mm') it still kept the old Format?

So I used the fract function and it works as desired

I then made use of the proposal of Gysbert and used rangemin instead of if ..

I know that when formatting on Surface, it still keeps the old Format, but did not thought that in script it's the same behaviour.

Or am I wrong?