- Task Recurrence
- General explanations
- Guide
- Create 6 or 8 new fields :
- Recurrence
- General
- Description
- Caption (in Grids)
- Type
Indicates if a task will recur
<img>arrow_refresh_small_Trans</img>
YN field
- Equations
- Auto-assignment rules
- Note : A "check" will automatically assign "d" to the DMY field and a default value of 1 to the RecXdmyAft field.
No rules... Unless you feel like adding some rules to add an icon to some icon field you have. Then
1- replace the "icon_statut" field in the next 2 rules with your own icon field name.
2- replace the icon name ("<img>arrow_refresh_small_Trans</img>") with the one you want (your own icon in the IQ icon folder)
Rules if you decide to try the above... :
A:icon_statut=AddKeyword ([icon_statut], "<img>arrow_refresh_small_Trans</img>") |
E:icon_statut=RemoveKeyword([icon_statut], "<img>arrow_refresh_small_Trans</img>")
- General
- RecEvXDMY
- General
- Description
- Caption
- Type
Recurence : How many Days, Months or years after current DueDate
Numeric Value to define how much time after the DueDate will the item-task be repeated.
ReAfDueDate
Number
- Equations
- Auto-assignment rules
AM:RecXdmyAft=|
A:recurrence=-1|
E:recurrence=iif(RecXdmyAft=0,0,-1)
- General
- RecXDMYAft
- General
- Description
- Caption
- Type
Recurence : How many Days, Months or years after Done Date
(Numeric Value to define how much time after the Done Date will the item-task be repeated.)
ReAfDone
Number field
- Equations
- Auto-assignment rules
AM:RecEvXdmy=|
A:recurrence=-1|
E:recurrence=iif(RecEvXdmy=0,0,-1)
- General
- DMY
- Editor
- Pop-up List
- Read Only
- Entry Must be in list
yyyy|q|m|ww|d
Checked
Checked
- General
- Description
- Type
(DayMonthYear -- To establish the unit for the recurrence (day(s), month(s), quarter(s), year(s) )
Value Time
d = Day
ww = Week
m = Month
q = Quarter
yyyy = YearText
- Equations
- Auto-assignment rules
A:recurrence=-1|
E:recurrence=
- Editor
- DoneLastDate
- General
- Type
Date
- General
- DoneAllDates
- General
- Type
Text
- General
- DueDatePast (optional!!)
- General
- Type
Text
- Equations
- Auto-assignment rules
AM:DueDatesAllPast=addALLKeyword(DueDatesAllPast, DueDatePast)
- General
- DueDatesAllPast (optional!!)
- General
- Type
Text
- General
- Modify these other fields :
- Check
- General
- Properties
- is "Done" field
CHECKED
- Properties
- Equations
- Auto-assignment rules
- Row Equation
- Auto Update
A:done=now|
A: TaskActStart = iif(Recurrence=0,taskactstart,0)|
A: TaskActEnd = iif(Recurrence=0,taskactend,0)|E:Done=|
E:DueDate=recurDateCalc(Recurrence, duedate, doneLastDate, RecXdmyAft, RecEvXdmy, dmy)
UncheckOnRecur(Recurrence, check, done)
CHECKED
- General
- Done
- General
- Description
Task (project, Item) completed.
- Equations
- Auto-assignment rules
A:check=1|
A:Today=|
A:Tomorrow=|
A:ThisWeek=|
A:NextWeek= |
A:Inbox= |
AM:DoneLastDate=Done |
AM:DoneAllDates=AddKeyword(DoneAllDates, formatdatetime(Done) & " ") |
E:check=
- General
- DueDate (optional!!)
- Equations
- Auto-assignment rules
AM:DueDatePast=formatdatetime(DueDate)
- Equations
- VB Editor (functions to add) :
- Open the VD editor (view->Visual Basic editor) and add these functions in "This Database" section (paste code as it is)
- 'recurDateCalc
- 'UncheckOnRecur
- 'AddALLKeyword
'Function used to calculate the next DueDate if a recurrence pattern has been set for an item.
'The function is used in auto-assign "check" field'Example : E:DueDate=recurDateCalc(Recurrence, duedate, doneLastDate, RecXdmyAft, RecEvXdmy, dmy)
Function recurDateCalc(Recurrence, duedate, done, RecXdmyAft, RecEvXdmy, DMY)
Dim NbrDMY, Tday, NewDueDate, DiffDay
NbrDMY = RecXdmyAft + RecEvXdmy
recurDateCalc = duedate
If (IsNull(NbrDMY) Or NbrDMY = 0) Or IsNull(DMY) Then Exit Function
If Recurrence=-1 Then
' Condition : if recurrence is set to repeat after date Due
If (IsNull(RecXdmyAft) Or RecXdmyAft = 0) Then
Tday = Int(Now)
NewDueDate = 0
DiffDay = Int(duedate) - Int(done)
'(condition p.1 : when task done late)
If DiffDay <= 0 Then
NewDueDate = DueDate
Do
NewDueDate = DateAdd( DMY,NbrDMY,Int(NewDueDate) )
Loop While Int(tday) >= Int(NewDueDate)
recurDateCalc = NewDueDate
'(... p.2 : task done in advance)
Else
recurDateCalc = DateAdd( DMY,NbrDMY,Int(DueDate) )
End If
' Condition : if Recurrence is set to repeat after date done
ElseIf (IsNull(RecEvXdmy) Or RecEvXdmy=0) Then
recurDateCalc = DateAdd( DMY,NbrDMY,Int(done) )
End If
Else
recurDateCalc = duedate
End If
End Function'Function used to "uncheck" checked items (done/checked items are... undone/unchecked) if they are marked as recurrent
'Used in "Check" Row EquationFunction UncheckOnRecur(Recurrence, check, done)
dim today
today = now
If ((int(today) - int(done) <> 0)) AND (check = -1 And recurrence = -1) Then UncheckOnRecur = 0 Else UncheckOnRecur=check
End FunctionFunction AddALLKeyword(Fi, keyw)
Dim myFi
myFi=Trim(Fi & "")
myFi=MyFi & " " & keyw
AddALLKeyword=myFi
End Function
- Open the VD editor (view->Visual Basic editor) and add these functions in "This Database" section (paste code as it is)
Manage fields dialog : When a field is created, it's not possible to edit anything in the "Editor" section | Bug | minor |
Comments
Function UncheckOnRecur(Recurrence, check, done)
dim today
today = now
If ((int(today) - int(done) <> 0)) AND (check = -1 And recurrence = -1) Then UncheckOnRecur = o Else UncheckOnRecur=check
End Function
UncheckOnRecur(Recurrence, check, done)
A:icon_statut=AddKeyword ([icon_statut], "arrow_refresh_small_Trans") |
E:icon_statut=RemoveKeyword([icon_statut], "arrow_refresh_small_Trans")
AM:RecXdmyAft=|
A:recurrence=-1|
E:recurrence=iif(RecXdmyAft=0,0,-1)
AM:RecEvXdmy=|
A:recurrence=-1|
E:recurrence=iif(RecEvXdmy=0,0,-1)
A:recurrence=-1|
E:recurrence=
A: TaskActEnd = |
A: TaskActEnd = iif(Recurrence=0,taskactend,0)|
Function recurDateCalc(Recurrence, duedate, done, RecXdmyAft, RecEvXdmy, DMY)
Dim NbrDMY, Tday, NewDueDate, DiffDay
NbrDMY = RecXdmyAft + RecEvXdmy
recurDateCalc = duedate
If (IsNull(NbrDMY) Or NbrDMY = 0) Or IsNull(DMY) Then Exit Function
If Recurrence=-1 Then
' Condition : if recurrence is set to repeat after date Due
If (IsNull(RecXdmyAft) Or RecXdmyAft = 0) Then
Tday = Int(Now)
NewDueDate = 0
DiffDay = Int(duedate) - Int(done)
'(condition p.1 : when task done late)
If DiffDay <= 0 Then
NewDueDate = DueDate
Do
NewDueDate = DateAdd( DMY,NbrDMY,Int(NewDueDate) )
Loop While Int(tday) >= Int(NewDueDate)
recurDateCalc = NewDueDate
'(... p.2 : task done in advance)
Else
recurDateCalc = DateAdd( DMY,NbrDMY,Int(DueDate) )
End If
' Condition : if Recurrence is set to repeat after date done
ElseIf (IsNull(RecEvXdmy) Or RecEvXdmy=0) Then
recurDateCalc = DateAdd( DMY,NbrDMY,Int(done) )
End If
Else
recurDateCalc = duedate
End If
End Function
CHECKED
A:done=now|
A: TaskActStart = iif(Recurrence=0,taskactstart,0)|
A: TaskActEnd = iif(Recurrence=0,taskactend,0)|
E:Done=|
E:DueDate=recurDateCalc(Recurrence, duedate, doneLastDate, RecXdmyAft, RecEvXdmy, dmy)
UncheckOnRecur(Recurrence, check, done)
CHECKED
========================
'Function used to "uncheck" checked items (done/checked items are... undone/unchecked) if they are marked as recurrent
'Used in "Check" Row Equation
Function UncheckOnRecur(Recurrence, check, done)
dim today
today = now
If ((int(today) - int(done) <> 0)) AND (check = -1 And recurrence = -1) Then UncheckOnRecur = o Else UncheckOnRecur=check
End Function
Function UncheckOnRecur_Test
AssertEqual 0, UncheckOnRecur( -1, -1, now-1)
AssertEqual 0, UncheckOnRecur( -1, 0, now-1)
AssertEqual 0, UncheckOnRecur( 0, 0, now-1)
AssertEqual -1, UncheckOnRecur( 0, -1, now-1)
AssertEqual -1, UncheckOnRecur( -1, -1, now)
AssertEqual 0, UncheckOnRecur( -1, 0, now)
AssertEqual 0, UncheckOnRecur( 0, 0, now)
AssertEqual -1, UncheckOnRecur( 0, -1, now)
End Function
Function UncheckOnRecur(Recurrence, check, done)
If (int(now) > int(done)) AND (check = -1 And recurrence = -1) Then UncheckOnRecur = 0 Else UncheckOnRecur=check
End Function
Function UncheckOnRecur_Test
AssertEqual 0, UncheckOnRecur( -1, -1, now-1)
AssertEqual 0, UncheckOnRecur( -1, 0, now-1)
AssertEqual 0, UncheckOnRecur( 0, 0, now-1)
AssertEqual -1, UncheckOnRecur( 0, -1, now-1)
AssertEqual -1, UncheckOnRecur( -1, -1, now)
AssertEqual 0, UncheckOnRecur( -1, 0, now)
AssertEqual 0, UncheckOnRecur( 0, 0, now)
AssertEqual -1, UncheckOnRecur( 0, -1, now)
AssertEqual 0, UncheckOnRecur( -1, -1, now-10)
AssertEqual -1, UncheckOnRecur( -1, -1, now+1)
End Function
Equations
Check (B):
Assign: A:done=now|
A: TaskActStart = iif(Recurrence=0,taskactstart,0)|
A: TaskActEnd = iif(Recurrence=0,taskactend,0)|
E:Done=|
E:DueDate=recurDateCalc(Recurrence, duedate, doneLastDate, RecXdmyAft, RecEvXdmy, dmy)
Row Eq: UncheckOnRecur(Recurrence, check, done)
Dependants fields: Check
Assign: A:check=1|
A:Today=|
A:Tomorrow=|
A:ThisWeek=|
A:NextWeek= |
AM:DoneLastDate=Done |
AM:DoneAllDates=AddKeyword(DoneAllDates, formatdatetime(Done) & " ") |
E:check=
Dependants fields: Check
Assign: AM:DueDatePast=formatdatetime(DueDate)
Dependants fields: StartDate,DueDateH
Assign: AM:DueDatesAllPast=addALLKeyword(DueDatesAllPast, DueDatePast)
Assign: A:recurrence=-1|
E:recurrence=
Assign: AM:RecXdmyAft=|
A:recurrence=-1|
E:recurrence=iif(RecXdmyAft=0,0,-1)
Recurrence (B): Indicates if a task will recur
Assign: A:icon_statut=AddKeyword ([icon_statut], "<img>arrow_refresh_small_Trans</img>") |
E:icon_statut=RemoveKeyword([icon_statut], "<img>arrow_refresh_small_Trans</img>")
Dependants fields: Check
RecXDMYAft (N): Recurence : How many Days, Months or years after D
Assign: AM:RecEvXdmy=|
A:recurrence=-1|
E:recurrence=iif(RecEvXdmy=0,0,-1)
VBScript
'The function is used in auto-assign "check" field
'Example : E:DueDate=recurDateCalc(Recurrence, duedate, doneLastDate, RecXdmyAft, RecEvXdmy, dmy)
Function recurDateCalc(Recurrence, duedate, done, RecXdmyAft, RecEvXdmy, DMY)
Dim NbrDMY, Tday, NewDueDate, DiffDay
NbrDMY = RecXdmyAft + RecEvXdmy
recurDateCalc = duedate
If (IsNull(NbrDMY) Or NbrDMY = 0) Or IsNull(DMY) Then Exit Function
If Recurrence=-1 Then
' Condition : if recurrence is set to repeat after date Due
If (IsNull(RecXdmyAft) Or RecXdmyAft = 0) Then
Tday = Int(Now)
NewDueDate = 0
DiffDay = Int(duedate) - Int(done)
'(condition p.1 : when task done late)
If DiffDay <= 0 Then
NewDueDate = DueDate
Do
NewDueDate = DateAdd( DMY,NbrDMY,Int(NewDueDate) )
Loop While Int(tday) >= Int(NewDueDate)
recurDateCalc = NewDueDate
'(... p.2 : task done in advance)
Else
recurDateCalc = DateAdd( DMY,NbrDMY,Int(DueDate) )
End If
' Condition : if Recurrence is set to repeat after date done
ElseIf (IsNull(RecEvXdmy) Or RecEvXdmy=0) Then
recurDateCalc = DateAdd( DMY,NbrDMY,Int(done) )
End If
Else
recurDateCalc = duedate
End If
End Function
'Function used to "uncheck" checked items (done/checked items are... undone/unchecked) if they are marked as recurrent
'Used in "Check" Row Equation
Function UncheckOnRecur(Recurrence, check, done)
If (int(now) > int(done)) AND (check = -1 And recurrence = -1) Then UncheckOnRecur = 0 Else UncheckOnRecur=check
End Function
Function UncheckOnRecur_Test
AssertEqual 0, UncheckOnRecur( -1, -1, now-1)
AssertEqual 0, UncheckOnRecur( -1, 0, now-1)
AssertEqual 0, UncheckOnRecur( 0, 0, now-1)
AssertEqual -1, UncheckOnRecur( 0, -1, now-1)
AssertEqual -1, UncheckOnRecur( -1, -1, now)
AssertEqual 0, UncheckOnRecur( -1, 0, now)
AssertEqual 0, UncheckOnRecur( 0, 0, now)
AssertEqual -1, UncheckOnRecur( 0, -1, now)
AssertEqual 0, UncheckOnRecur( -1, -1, now-10)
AssertEqual -1, UncheckOnRecur( -1, -1, now+1)
End Function
Function AddALLKeyword(Fi, keyw)
Dim myFi
myFi=Trim(Fi & "")
myFi=MyFi & " " & keyw
AddALLKeyword=myFi
End Function