Weeknumber minus 1

Discuss RoboTask here

Weeknumber minus 1

Postby rice1973 » Wed Nov 06, 2013 9:10 am

Hello Oleg,

What do i have to change to set the week number minus 1 by the variable ; {WeekOfTheYear({Date})}
And at what day does the new week start? Is it on monday?

Kind regards,

Maurice
Robotask rules! :)
rice1973
 
Posts: 86
Joined: Mon Jan 04, 2010 2:38 am
Location: Netherlands

Re: Weeknumber minus 1

Postby Oleg » Wed Nov 06, 2013 11:00 am

New week begins on Monday.

See the example below how to calculate WeekOfTheYear-1
Code: Select all
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|317955339
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task730"
Hide=INTEGER|0
ID=INTEGER|73766993
LogOnAsUser=INTEGER|1
Name=STRING|"Week of the year - 1"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""WEEKNUM"" with value ""{WeekOfTheYear({Date})}"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"1"
varkind=STRING|"1"
varname=STRING|"WEEKNUM"
varvalue=STRING|"{WeekOfTheYear({Date})}"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_INCREMENT"
Enabled=INTEGER|-1
Name=STRING|"Increment variable ""WeekNum"""
Params=FOLDER

[Actions\Action2\Params]
incement=STRING|"-1"
vaiable=STRING|"WeekNum"

[Actions\Action3]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""[{Time}, {DayOfWeek}, {Date}]"""
Params=FOLDER

[Actions\Action3\Params]
icon=STRING|"1"
msg0=STRING|"[{Time}, {DayOfWeek}, {Date}]"
msg1=STRING|"Week of the Year: {WeekOfTheYear({Date})}"
msg2=STRING|"Week of the Year - 1: {WeekNum} "
msgcount=STRING|"3"
playsound=STRING|"0"
showmessage=STRING|"1"
Oleg Yershov
Oleg
Site Admin
 
Posts: 2611
Joined: Thu Jan 01, 1970 1:00 am

Re: Weeknumber minus 1

Postby rice1973 » Wed Nov 06, 2013 11:46 am

Ok,

Is it not as simple as {IncDays(-1)} ?
Robotask rules! :)
rice1973
 
Posts: 86
Joined: Mon Jan 04, 2010 2:38 am
Location: Netherlands

Re: Weeknumber minus 1

Postby Oleg » Wed Nov 06, 2013 1:07 pm

What do you want to get: yesterday's date or number of previous week?
{IncDays(-1)} - the day number (not week number or date)
{DateIncDays(-1)} - the date of yesterday
Oleg Yershov
Oleg
Site Admin
 
Posts: 2611
Joined: Thu Jan 01, 1970 1:00 am

Re: Weeknumber minus 1

Postby rice1973 » Thu Nov 07, 2013 8:37 am

I want to get the number of previous week. :)
Robotask rules! :)
rice1973
 
Posts: 86
Joined: Mon Jan 04, 2010 2:38 am
Location: Netherlands

Re: Weeknumber minus 1

Postby Oleg » Thu Nov 07, 2013 9:23 am

So, look at my example above.
Oleg Yershov
Oleg
Site Admin
 
Posts: 2611
Joined: Thu Jan 01, 1970 1:00 am

Re: Weeknumber minus 1

Postby Micha » Wed Feb 03, 2021 4:31 pm

Where to use the code when I want to use the variable? Should I copy the code to "Local variables"???
Micha
 
Posts: 3
Joined: Fri Feb 15, 2019 9:50 am

Re: Weeknumber minus 1

Postby Oleg » Sun Feb 14, 2021 9:55 am

Where to use the code when I want to use the variable? Should I copy the code to "Local variables"???

Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
You can see the task and use task editor to edit it and see all parameters of each step
Oleg Yershov
Oleg
Site Admin
 
Posts: 2611
Joined: Thu Jan 01, 1970 1:00 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 15 guests