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')
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' )