How to convert the Days of the Week into a numeric value in Vijeo Designer?
Published date:
14 December 2018
Issue: How can we convert the days of the week, such as Monday, Tuesday, Wednesday, and etc, to numeric values in Vijeo Designer?
Product Range: Vijeo Designer version 6.2 or higher.
Resolution: In order to convert the days of the week in string form to a numeric value, you will need to create the following:
1) Create a string variable Day_Of_Week to store the value of the day of the week (Monday, Tuesday, etc) and create an INT varialbe NumericalDay to store the numerical value.
2) Create a Conditional Action that is set to execute On Data Change of the variable created at step 1.
3) In the action, add a script.
4) In the script have something like this:
String DayOfWeek=Day_Of_Week.getStringValue();
if(DayOfWeek.equals("MON")
{
NumericalDay.write(1);
}
if(DayOfWeek.equals("TUE")
{
NumericalDay.write(2);
}
.
.
.
.
if(DayOfWeek.equals("SUN")
{
NumericalDay.write(7);
}
Can't find what you are looking for?
Reach out to our customer care team to receive information on technical support, assistance for complaints and more.