Focal Point
[CLOSED] Update Date HTML Composer - System time

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5807086476

February 11, 2015, 12:57 PM
BI_Developer
[CLOSED] Update Date HTML Composer - System time
Hello

I have a HTML page with reports on it and there is a text box which is dynamically populated from a fex.
It shows the date/time when database is next updated. At that time, if the HTML page is refreshed, reports show updated data.

Is there a way to turn that date/time to different color or something similar, when system time passes next update date/time?
This would help user to easily notice that update data is available and he should refresh the page.

Please suggest.

Thanks..

This message has been edited. Last edited by: <Kathryn Henning>,


WF 8.2.01 APP STUDIO
PDF,HTML,EXL2K,Active
February 11, 2015, 01:24 PM
MartinY
Process with js where you'll compare the two dates (update date vs system date) and change the color of the field accordingly.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
February 11, 2015, 01:26 PM
BI_Developer
quote:
Originally posted by MartinY:
Process with js where you'll compare the two dates (update date vs system date) and change the color of the field accordingly.


Its not working somehow.
field in my database is HMDI format. converted to alpha and compared with system date but getting wrong result.

This message has been edited. Last edited by: BI_Developer,


WF 8.2.01 APP STUDIO
PDF,HTML,EXL2K,Active
February 11, 2015, 02:43 PM
MartinY
Can you share your code and show some data sample ?


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
February 11, 2015, 02:53 PM
BI_Developer
quote:
Originally posted by MartinY:
Can you share your code and show some data sample ?


Data from data base: 02/11 14:33  (HMDI FORMAT)
Converted to Alpha
TIME1/A11 =  HCNVRT(DATE_DISP, '(HMDI)', 11, 'A11');

Passed it as amper variable to HTML file

JavaScript for system date: 
var currentdate = new Date(); 
var sys_date_time = (currentdate.getMonth()+1) + "/"
                +   currentdate.getDate()  + " "
                + currentdate.getHours() + ":"  
                + currentdate.getMinutes();


if (sys_date_time < '!IBI.AMP.DATE_NEW;')
{
	alert("less values");
}
else
{
	alert("greater values");
}





WF 8.2.01 APP STUDIO
PDF,HTML,EXL2K,Active
February 11, 2015, 03:14 PM
MartinY
Try displaying the value of your variable sys_date_time and !IBI.AMP.DATE_NEW and you'll see that sys_date_time doesn't have the leading 0 (zero).

You're comparing 2/11 15:6 with 02/11 14:33

You need the adjust your code to add the leading 0 for all part of your sys_date_time.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
February 11, 2015, 03:15 PM
eric.woerle
BI Developer,

This is purely a JS question and your going to find better examples on JS forums. I did do a quick google search on comparing times in JS and came across this page

http://stackoverflow.com/quest...in-the-format-hhmmss

I would suggest looking into this.


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
February 12, 2015, 10:00 AM
BI_Developer
quote:
Originally posted by MartinY:
Try displaying the value of your variable sys_date_time and !IBI.AMP.DATE_NEW and you'll see that sys_date_time doesn't have the leading 0 (zero).

You're comparing 2/11 15:6 with 02/11 14:33

You need the adjust your code to add the leading 0 for all part of your sys_date_time.


I appended 0 but I think its not correct. Its like comparing alpha values, not time values.


WF 8.2.01 APP STUDIO
PDF,HTML,EXL2K,Active
February 12, 2015, 10:10 AM
MartinY
If above Eric solution doesn't work for you, it will look weird but you can change your alpha dates to number instead and then compare.

15/02/11 14:33 --> 1502111433
15/02/11 15:06 --> 1502111506

If 1502111506 < 1502111433 then ... else ...

But I suggest to also consider the year when comparing as number. Otherwise you will have issue.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007