Display Current Date & Time in Smartportal

To display the current date and time in the smart portal. Create a global script as listed below. You need to be aware that the clock will interfere when debugging client scripts. To ovecome this issue use the debug swith when instantiating the rich client. An example URL with the dubug switch might be as follows:

http:// /epower/rdaui.htm?&http:// &debug

''Note: I always insert the line If Not UIMaster.DbgFlag Then On Error Resume Next in all my client scripts. In the development environments I use the debug switch to ignore the On Error Resume Next statement. However, in the LIVE environment, where no debug switch is used, the On Error Resume Next statement traps all runtime errors.''

Global Script:

Call PortalPreLoad

Sub PortalPreLoad

If Not UIMaster.DbgFlag Then On Error Resume Next

gstrBackgroundColour = UIMaster.documentTop.bgcolor

Dim obj: Set obj = UIMaster.documentMenu.getElementsByTagName("TABLE")(0).insertRow(3).insertCell(0)

If UIMaster.DbgFlag Then

' insert date if in debug mode

obj.innerText = "Debugging - " & Date

obj.style.color = "White"

obj.style.backgroundColor = gstrBackgroundColour

obj.style.fontSize = "8pt"

Else

' insert clock.htm as not in debug mode

obj.innerHtml = " "

End If

End Sub

Now create clock.htm, which is the web page that will be displayed in the smart portal. As this is a web page it could also be referenced from a web segment on an AA form.

Paste the following code into notepad and save as clock.htm to the epower/www folder.











Paul.ainsley 20:34, 30 March 2009 (UTC)