Hi!
maybe someone can help me write the script expression in switch on a condition with variables.
I would like to compare the Proper Job Name (it is: "2019_08_23") with the scripted comparison value like this:
var pubdate = new Date();
var pubdateday = pubdate.getDate()+"";
var edd = pubdateday
if (edd < 10)
{
edd = "0" + pubdateday;
}
else
{
edd = pubdateday;
};
var pubdatemonth = (pubdate.getMonth()+1)+"";
var edm = pubdatemonth
if (edm < 10)
{
edm = "0" + pubdatemonth;
}
else
{
edm = pubdatemonth;
};
var pubdateyear = (pubdate.getYear()*1 +1900)+"";
var today = pubdateyear + "_" + edm + "_" + edd;
pubdate = today;
The scripted value "pubdate" is correct "2019_08_23" but I think I have to tell switch, that the Proper Job Name is meant?!
thx all for your help!
define script expression
Re: define script expression
I know it is fun to do scripting.
There is an app that do what you seem to want to accomplish. And it is FREE
https://www.enfocus.com/en/appstore/pro ... calculator
There is an app that do what you seem to want to accomplish. And it is FREE
https://www.enfocus.com/en/appstore/pro ... calculator
Re: define script expression
Hi Jan,
thanks for your answer!
That helped!!!
Where I would have liked to know why the script didn't work or how the correct settings would have been.
The Proper Job Name and the script expression string should have the same value (=2019_08_23). But why is the comparsion not true...?
greetings.
marc.
thanks for your answer!
That helped!!!
Where I would have liked to know why the script didn't work or how the correct settings would have been.
The Proper Job Name and the script expression string should have the same value (=2019_08_23). But why is the comparsion not true...?
greetings.
marc.
Re: define script expression
The date you have is in String format, to do calculation on the dates you have to parse that string in to a number. That number is in milliseconds starting on 1st of January 1970.
When you have got your resulting number you can then create a date string from it.
https://www.enfocus.com/manuals/Develop ... _date.html
When you have got your resulting number you can then create a date string from it.
https://www.enfocus.com/manuals/Develop ... _date.html
Re: define script expression
Hi Jan,
but isn't my string result fine?
I deliberately change the date value to a string.
the script result is than 2019_08_23 and the proper job name ist also 2019_08_23
both are strings.
Now, when i compare these two values, the result should be true.
or am I wrong?
but isn't my string result fine?
I deliberately change the date value to a string.
the script result is than 2019_08_23 and the proper job name ist also 2019_08_23
both are strings.
Now, when i compare these two values, the result should be true.
or am I wrong?