Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a field call Shift time which is Day or Night. Based on the current time that the Application is opened I want to display only the Day shift hours production or the Night shift production.
My If statement would look like this
If (Hour(localtime()) between 7 and 19 then 'Day','Night')
I have no idea how to do this or where to start.
Hello Susan
The following should help you out.
1. Create a variable in the application called vTimeOpen
2. Create a Macro in your Macro code as follows:
SUB SetOpenTime
ActiveDocument.Variables("vTimeOpen").SetContent HOUR(Now()), true
END SUB
3. Call this Macro when opening the document, go to Settings, Document Properties, Macros, then on the document event triggers section, add the macro to the OnOpen event. This means that every time the document is opened, this macro will be called and the value of the variable will be set to the current hour.
4. In you chart/table etc, you can use the following expression: =IF ( vTimeOpen >= 7 AND vTimeOpen <=19 , 'Day', 'Night' )
That should do it for you.
Regards,
Nigel.