Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Contact Us
  • Home
  • Products
  • Automation Systems
  • Human Machine Interfaces (HMI)
  • NA

How to edit TIMESPAN and DATE variables in NA

Written by Arlo D'Cruz

Updated at February 13th, 2025

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Products
    Automation Systems Control Components Motion & Drives Quality control & Inspection Robotics Safety Sensing Services Software Switching Components
  • Amplify e-Store
    e-Store public
  • Public CSC
+ More

The TIMESPAN and DATE type variables are not compatible with the DataEdit object which means there is no easy way to let the user enter a new value for these data types. 

Sysmac does have keyboards which allow you to enter TIMESPAN or DATE types. These keyboards can be called manually via script. 

Example: Modifying a TIMESPAN via script

1. Define your TIME variable on the PLC

2. Define your TIMESPAN variable mapping on the HMI

3. Create a “DataDisplay” object linked to your TIMESPAN variable

4. Create an action which triggers when the user clicks the DataDisplay. The action will call a subroutine.

5. Add the following code to your subroutine (adjust the variable name as required)

Sub GetTIMEKeypad
	EditVariable( "HMITimeSpan")
End Sub

Your DataDisplay should now automatically show a keypad when pressed that allows you to edit the TIMESPAN variable.

 
 

Example: Modifying a DATE via script

DATE keypads can be generated in much the same way as Timespan keypads. We have created a separate section for the DATE type as the default keypad should be modified as the default range is from the year 2000 to 2025. 

1. Define your DATE_AND_TIME variable on the PLC

2. Define your DATE variable mapping on the HMI

3. Create a “DataDisplay” object linked to your DATE variable

4. Create an action which triggers when the user clicks the DataDisplay. The action will call a subroutine.

5. Add the following code to your subroutine (adjust the variable name as required)

Sub GetDATEKeypad
	
	EditVariable( "HMIDate",,,,,,,,,"Group0")
	
End Sub

6. Create a custom keypad group and add a DateTimeKeypad

7. Edit the DateTimeKeypad. Select the "Year" drop-down and go to assign. You can modify the range by clicking the "+" icon. Modify the items as required to get the desired range of years. Note that a value of 0 correlates to the year 2000. 

Your DataDisplay should now automatically show a keypad when pressed that allows you to edit the DATE.

 
 

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • CX-Thermo doesn't connect to my Temperature Controller
  • How to Set Up User Authentication on NJ and NX PLCs
  • How to Configure NTP for CP1L/NX series PLCs
  • Obtaining your NA HMI IP address at runtime

Definition by Author

0
0
Expand