Submitted by Armando on 2010/05/09 16:25
Updated 2010 05 29
[sorry about the formatting... It's damn hard to format stuff with this HTML editor]
 
  • Task Recurrence

  • It's not that difficult  to manage item recurrences in IQ. Maybe not in a very sophisticated way, but in a practical and probably efficient enough way.
     
    In any case it's implemented in my own DB and I'm satisfied with the result for now....
     
     
     Note :there's a small bug in the "manage fields dialog" that will lock the "pop-up list" text box when you first create a field [Editor section].
     
    Just switch to another field and then back to the new field and the text box will be unlocked. This has been entered in Mantis already.
     
     

    Manage fields dialog : When a field is created, it's not possible to edit anything in the "Editor" section
     
     
    Bug
    minor
     
     
     
    I tried this version with a sample DB and it works.
     
    Shoudn't take more than 10-15 min. to apply the changes to an existing DB.
     
     
    I also provide a sample DB in which the recurrence is exemplified (see attached file)
     
    The provided sample DB is a bit more complex then what is found here... And not completely up to date... as I haven't got the time to simplify it and update it... But it does give an idea of what's possible to do.
     
    Hopefully, these explanations (formatted with IQ...)  are clear enough.
    • General explanations

    • This is a simplified version of my own task/item recurrence implementation.
       
      Missing in this "stripped down version are :
       
      1- conditional formatting,
      2- more sophisticated other linked task management features making use of all the gantt possibilities, other task related fields etc.
      3- goodies like icons, etc. etc. :)
       
       
      What it does  : replaces the current DueDate according to a certain time value after it's been marked as done. The recurrence is calculated in days, weeks, months or years (according to the user's choice), and is  calculated from the DueDate or the done date (as a starting point) depending on the type of chosen recurrence.
       
       
      It's possible to see all the past done and due dates for a recurring item (2 different fields are used for that)
       
       
      What it doesn't do : it doesn't do more sophisticated recurrence patterns -- like every Tuesdays and Mondays for 3 weeks, etc. --  as I didn't find that it was worth the trouble. The calendar can do these well and I tend to use the calendar for these "day bound" tasks (which can't be done on other days). In any case, this implementation is currently enough for my day to day and project management use.
       
      Adding other recurrence features would mean adding a few more fields and I preferred a leaner implementation to not crowd up my grid with too many columns (I like to see most relevant column in the grid, not in a form in the properties pane). I could've added a dialog to populate these fields, but... Like I said, this gets the job done while I'm waiting for the real recurrence implementation. (I really needed recurrence to move all my tasks from Outlook to IQ).
       
      What could be easily added would be : stop recurrence after "x" d/w/m/y 
       
      P.S. Sorry, my fields some of the fields have barbaric names as I created all that hastily and didn't know I was going to share it.
       
       
       
      Follow the guide...
       
      Follow the guide (with precision) for the recurrence to work.
      What is marked as optional can be skipped.
       
      But if one optional step is skipped, ALL other optional ones should be skipped.
       
      Everything YELLOW (bright or pale)  needs to be copied and pasted (except for things like "Checked" etcé, which means that the check box needs to be checked, etc.)
       
      Field names must be copied PERFECTLY for the recurrence to work. Otherwise you'll get errors. (And don't copy the "optional " qualifier !)
       
      Captions (for grids headers) are just suggestions. Do as you wish -- some icons are included in the sample file at the end of this post.
       
       
       
      =================
       
      How it works :
       
      Once you've created all the fields you need to create (see explanations in the following GUIDE) :
       
      You'll need to have these 4 new fields/columns in your todo grid or in a form for easy access :
       
      RecXDMYAft, RecEvXDMY, DMY, recurrence
       
      Then to see it in action:
       
      1- check the recurrence field
      2- assign a value to the ReAfDone (RecXDMYAft ) or ReAfDueDate (RecEvXDMY)
      3- choose your unit : d, m, w, y...
       
      That's it. Then  :
       
      1- "Check"or mark  an item as done (using the done field) .
      2- After midnight, recurring tasks are automatically unchecked/undone and will be set a new duedate.
      If you manually uncheck the check field, it'll do the same : a new DueDate will be set for the unchecked item.
       
    • Guide

    • For each field (in bold-italics), sections from the "manage fields" (view-> manage fields) dialog are indicated, with the changes to make.
      All the field creation + modifications shouldn't take more than 15-20 min -- When I tried to implement from scratch in a sample DB, it took me 5 min.
      • Create 6 or 8 new fields :
        • Recurrence
          • General
            • Description

            • Indicates if a task will recur

            • Caption (in Grids)

            • <img>arrow_refresh_small_Trans</img>

            • Type

            • YN field

          • Equations
            • Auto-assignment rules

            • 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>")

               

               
              • Note : A "check" will automatically assign "d" to the DMY field and a default value of 1 to the RecXdmyAft field.
        • RecEvXDMY
          • General
            • Description

            • 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.

            • Caption

            • ReAfDueDate

            • Type

            • Number

          • Equations
            • Auto-assignment rules

            • AM:RecXdmyAft=|
              A:recurrence=-1|
              E:recurrence=iif(RecXdmyAft=0,0,-1)
        • RecXDMYAft
          • General
            • Description

            • 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.)

            • Caption

            • ReAfDone

            • Type

            • Number field

          • Equations
            • Auto-assignment rules

            • AM:RecEvXdmy=|
              A:recurrence=-1|
              E:recurrence=iif(RecEvXdmy=0,0,-1)
               
        • DMY
          • Editor
            • Pop-up List

            •  yyyy|q|m|ww|d

            • Read Only

            • Checked

            • Entry Must be in list

            • Checked

          • General
            • Description

            • (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   =   Year   

            • Type

            • Text

          • Equations
            • Auto-assignment rules

            • A:recurrence=-1|
              E:recurrence=
               
        • DoneLastDate
          • General
            • Type

            • Date

        • DoneAllDates
          • General
            • Type

            • Text

        • DueDatePast (optional!!)
          • General
            • Type

            • Text

          • Equations
            • Auto-assignment rules

            • AM:DueDatesAllPast=addALLKeyword(DueDatesAllPast, DueDatePast)

        • DueDatesAllPast (optional!!)
          • General
            • Type

            • Text

      • Modify these other fields :
        • Check
          • General
            • Properties
              • is "Done" field

              • CHECKED

          • Equations
            • Auto-assignment rules

            • 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 Equation

            • UncheckOnRecur(Recurrence, check, done)

              • Auto Update

              • CHECKED

        • 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=

        • DueDate (optional!!)
          • Equations
            • Auto-assignment rules

            • AM:DueDatePast=formatdatetime(DueDate)

      • 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

          • '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

             

          • 'UncheckOnRecur

          • '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 = 0 Else UncheckOnRecur=check 
            End Function

          • 'AddALLKeyword

          • Function AddALLKeyword(Fi, keyw)
              Dim myFi
              myFi=Trim(Fi & "")
              myFi=MyFi & " " & keyw
              AddALLKeyword=myFi
            End Function

             

 

Comments

Keith asked for some details so here they are. (see first post)

Jibz

2010/05/17 03:13

In reply to by Armando

Thanks for posting this.
 
Having item recurrence work in the grid as well was actually on my list of ideas to post here (I keep that list in IQ, very proud of myself there).
 
What prompted me to think about it was that I put the birthdays of my relatives into the calendar as yearly recurrences, and then expected them to show up in the appropriate grids like for instance Appointments. To my surprise they didn't appear.
 
Searching the online manual I found that recurring items only appear the first time, and I had set the start date to the year of birth (to be able to show age).
 
I was thinking it should be possible to somehow hack it using a function much like you did, but I figured it would be worth suggesting adding it to the actual program, since it seems like something people are likely to expect; to have birthdays show up in the grids properly.
 
I am guessing it is because the calendar and IQ are not that tightly coupled at the moment. The information about recurrence is stored somewhere else than the fields of the item.

Armando

2010/05/17 10:56

In reply to by Jibz

[quote=Jibz]
Thanks for posting this.
 
Having item recurrence work in the grid as well was actually on my list of ideas to post here (I keep that list in IQ, very proud of myself there).
 
What prompted me to think about it was that I put the birthdays of my relatives into the calendar as yearly recurrences, and then expected them to show up in the appropriate grids like for instance Appointments. To my surprise they didn't appear.
 
Searching the online manual I found that recurring items only appear the first time, and I had set the start date to the year of birth (to be able to show age).
 
I was thinking it should be possible to somehow hack it using a function much like you did, but I figured it would be worth suggesting adding it to the actual program, since it seems like something people are likely to expect; to have birthdays show up in the grids properly.
 
I am guessing it is because the calendar and IQ are not that tightly coupled at the moment. The information about recurrence is stored somewhere else than the fields of the item.
[/quote]
 
Hi jibz, thanks for your comments.
Pierre has other ideas for item recurrence, with and without the calendar, and with different types of recurrences ("virtual" or real). It's been discussed a few times.
However, the reason I posted this is only
1- because I thought that some might be interested in a intermediary solution in the meantime.
When the real solution will  arrive I'll just transfer my recurring items to it -- a 15-20min only task, most probably.
2- to show another thing that can be done with IQ, just by using what's already there.

Armando

2010/05/17 12:33

In reply to by Jibz

I saw on DC that you're a developer. Cool! I'm sure you'll find faults in my functions as they could be more "condensed"... I must say what I was more interested in having a quick solution for myself so I didn't "optimize" anything... yet.
It'll be interesting to see what you can come up with... with IQ (in general).

Pierre_Admin

2010/08/31 14:11

In reply to by Jibz

[quote=Jibz]
What prompted me to think about it was that I put the birthdays of my relatives into the calendar as yearly recurrences, and then expected them to show up in the appropriate grids like for instance Appointments. To my surprise they didn't appear.
 
Searching the online manual I found that recurring items only appear the first time, and I had set the start date to the year of birth (to be able to show age).
 
I was thinking it should be possible to somehow hack it using a function much like you did, but I figured it would be worth suggesting adding it to the actual program, since it seems like something people are likely to expect; to have birthdays show up in the grids properly.
 
I am guessing it is because the calendar and IQ are not that tightly coupled at the moment. The information about recurrence is stored somewhere else than the fields of the item.
[/quote]
 
This is not really the cause. Ecco Pro 4.01, the last one, had the same "issue". Only the calendar can show recurring events correctly. Grids (Notepads in Ecco), show the first instance only.
 
What is required here is the possibility to change a virtual item (i.e. a recurrence) to be a real item, so it appears in grids, so you can add notes specific to this specific instance of an event
 
This is definitely planned. If someone adds it to Mantis, I'll look into implementing this in v0.9.26
 

Tom

2011/06/01 11:21

In reply to by Pierre_Admin

Came across this today
[quote=Pierre_Admin]What is required here is the possibility to change a virtual item (i.e. a recurrence) to be a real item, so it appears in grids, so you can add notes specific to this specific instance of an event
 
This is definitely planned. If someone adds it to Mantis, I'll look into implementing this in v0.9.26
[/quote]was this ever added to mantis?
(I can do if it's not already there)
 
 
...really odd formatting on this page :-)

Armando

2011/06/01 11:27

In reply to by Tom

Hi Tom,
No, I don't think it was ever added to Mantis (I know that Pierre will implement that for sure though).
And... yes, the formatting here is really weird. :)
 
--------------------------------------------------------------------------------
Windows XP Home Edition, Service pack 2
Dell Vostro 1500, Ram:3gb, CPU:Core2Duo T7500 2.2ghz

Tom

2011/06/01 13:36

In reply to by Tom

 
Mantis 1130
 
1130 Ability to show recurring items in grid as individual items for each recurrence  New featurefeaturenew  2011-06-01 13:35tomos
 

Armando

2010/05/17 13:24

In reply to by Armando

I made several mistakes as I posted the guide to rapidly. I'll post an update right away without the typos that's prevent it to actually work ! Sorry!! 
 
[EDIT : I'll post the corrected guide in the first post of this thread as it's the only one I can constantly update if there's a mistake.]
 

I updated one function, because I had some problems in a specific case where the Task%Complete was set to 100% and check was automatically "checked". This caused Check to be immediately unchecked and Task%Complete to stay at 100%. This is because I have many auto assigns and functions to automate certain field relationships (chek = true  <--> Task%Complete = 100 ).
 
In any case, this might not change anything for most users who'll try this, but it solves the problem if you had it... as it forces the automatic unchecking of the "Check" field to happen the next day (minimum).
 
 
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
 
(the function has already been updated in the first post)
 
 
Note : I haven't updated the sample zipped file included in the first post though... Note also that you can write anything for the fields "captions" in grids. I noticed that one of the captions I suggested was an icon which is not included in the default icon set. However, it is included in the sample zipped file I provided.

Armando

2010/05/22 00:05

In reply to by Armando

Oops, I forgot to update the "check" row equation in the guide :
It should be like that :
 
UncheckOnRecur(Recurrence, check, done)
 
Hopefully, nobody lost time on that... But it doesn't seem lime it... ;)
 
I'm going to change the format of what needs to be copied and pasted for easier readability.

I now have icons for all recurrence columns... Except for the DMY field, which is short enough to fit in the column header.
If someone want the icons, just ask. There custom made, so not great, but better than a long description in the column header.
 
(Also : don't forget to make the above mentioned changes if you did try it and it didn't work!)

I changed my mind about how checking the "recurrence" field would automatically populate 2 other fields with arbitrary values (i.e. : repeat 1 day after completed).
 
My own usage showed me that I never tend to check the recurrence field first but always fill the details about it (e.g. repeat every 2 weeks...). So I changed some auto-assign rules so that when the fields defining the recurrence parameters are filled, the "recurrence" field us automatically checked, and when those are deleted, it's automatically unchecked. However, it's also now possible to fill these parameters and turn recurrence on or off, which can be useful.
 
Here are the corrections in the auto-assign rules of these fields (I will also indicate these changes in the first post):
 
 
Recurrence
 
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 ("arrow_refresh_small_Trans") 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], "arrow_refresh_small_Trans") |
E:icon_statut=RemoveKeyword([icon_statut], "arrow_refresh_small_Trans")
 
 
 
 
RecEvXdmy
 
AM:RecXdmyAft=|
A:recurrence=-1|
E:recurrence=iif(RecXdmyAft=0,0,-1)
 
 
RecXdmyAft

AM:RecEvXdmy=|
A:recurrence=-1|
E:recurrence=iif(RecEvXdmy=0,0,-1)
 
 
DMY
 
A:recurrence=-1|
E:recurrence=

Armando

2010/05/30 12:22

In reply to by Armando

I also changed the Check auto-assign rules. Forgot to mention as I don't think it will usually have an incidence on other's DB. I does in mine as the TaskActEnd and TaskActStart fields are linked to all kinds of other stuff.
 
2 of these rules used to be
 
 
A: TaskActStart = |
A: TaskActEnd = |
 
And now it's :
 
A: TaskActStart = iif(Recurrence=0,taskactstart,0)|
A: TaskActEnd = iif(Recurrence=0,taskactend,0)|
 
 
See the code in the first post.
 
P.S. : There's another change in one of the functions, but it doesn't change anything (just cleaner) so will post it later -- have to run.

I made a few changes to the recurDateCalc function. I think it's better now. But if you have suggestion, please tell me.
 
 
1- Recurrence, when set to happen based on the Due Date (and not the Done date), is calculated so that it's always set after "today" -- not in the past.
 
I was used to Outlook's recurrence behaviour But realize I didn't like it. I.e. :  if some task was set to repeat every 4 days, and you haven't done it for a full year, it will force you to mark it as complete for every 4 days up to... "now". I never liked that, so since I get to set my own recurrence function behaviours, I decided that when I complete a task, the next DueDate will always be set in the future (never in the past)... Of course calculating the next occurrence taking into account the last DueDate, of course, so that the given time pattern is respected.
 
2- If the recurrence compulsory fields (nbr of dayw, weeks, months, etc.) aren't filled, the DueDate won't change when a task is "Unchecked" (or "undone"), even if recurrence is set "on" (checked). Before, the DueDate was erased.
 
3- if recurrence is Off, the DueDate won't change when a task is "Unchecked" (or "undone"). Before, the DueDate was erased.
 
 
 

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

Just a small tip.
 
If you check (i.e : mark as done) by mistake a task and would like to set it back to the last duedate, or if you want do see when a task was last done, etc. you can always refer to all these useful fields (that's why these were created in the first place, but also for useful filtering):
 
 
DoneAllDates
DoneLastDate
 
DueDatePast
DueDatesAllPast
 
 
The kind of filtering I can do with these? Well, let's say I want to see what were the tasks done on May 26  I'd use the date toolbar of course, and set it like that :
 
 
(Make sure that the filter toolbar isn't in contradiction with that request though...)
 
You could also use the filter text box and enter something like :
 
Donelastdate =  #2010 05 26#
 
You can achieve many things with the date toolbar anyways (without having to use the filter text box in the source bar.)

Thank you for the effort that obviously went into posting this with all this detail. Hopefully we will get field import/export someday and that should make stuff like this much easier to share.
 
I do have a question in terms of how it works. It seems that I have to check and uncheck the Check field to get the due date updated? I would have expected I would check it and it would uncheck itself. Even if I change the UncheckOnRecur function to simply set the value (like your SNDB example) I still have to uncheck it. If I manually run the row equations it will uncheck itself, but refresh does not. Is there a trick to row equations I am missing?
 
I'll add I tried to do something like this a year or so ago, but gave up because I couldn't get the uncheck to work and couldn't figure out how to debug effectively. Kudos to you for getting it working.
 
Thanks,
dave

Armando

2010/08/19 10:27

In reply to by reesd

[quote=reesd]
Thank you for the effort that obviously went into posting this with all this detail. Hopefully we will get field import/export someday and that should make stuff like this much easier to share.
 
I do have a question in terms of how it works. It seems that I have to check and uncheck the Check field to get the due date updated? I would have expected I would check it and it would uncheck itself. Even if I change the UncheckOnRecur function to simply set the value (like your SNDB example) I still have to uncheck it. If I manually run the row equations it will uncheck itself, but refresh does not. Is there a trick to row equations I am missing?
 
I'll add I tried to do something like this a year or so ago, but gave up because I couldn't get the uncheck to work and couldn't figure out how to debug effectively. Kudos to you for getting it working.
 
Thanks,
dave
[/quote]
 
Hi Dave,
 
Thanks for your message.
 
Actually, it'll uncheck the check field automatically after midnight. (When rows equations set on "auto update" are re-performed)
 
One drawback : if you insert a past done date in the done field... The check field will automatically check/uncheck and you'll have to manually readjust a few fields... I don't remember which ones but I'll check that.
 
I made a few changes to my own script here, which I didn't post because I wasn't sure if it was truly necessary. I'll see if there are notable differences and post back.

reesd

2010/08/23 19:15

In reply to by Armando

[quote=Armando]
Actually, it'll uncheck the check field automatically after midnight. (When rows equations set on "auto update" are re-performed)
differences and post back.[/quote]
 
Is there anyway to get it to run the row equation sooner? I thought maybe F5 would do it, but it doesn't. I can run it from inside the field management window by clicking on the refresh button next to the row equation, but that obviously will not work for normal use.
 
Also, if you can give me a bit more information on how auto update works for row equations I will update the doc. Doesn't seem to be any info for it in there. Is it basically they are run automatically at midnight or next time you log on if the day has changed?
 
d

Armando

2010/08/23 23:13

In reply to by reesd

[quote=reesd]
Is there anyway to get it to run the row equation sooner? I thought maybe F5 would do it, but it doesn't. I can run it from inside the field management window by clicking on the refresh button next to the row equation, but that obviously will not work for normal use.
[/quote]
 
There are 2 ways :
 
1- The easiest way to manually uncheck all those checked items... And the DueDate will be set to the next calculated day.
 
I'd use the filter to see all items done today ( done=int(now) ) , and just uncheck them all at once.
 
 
2- There's also the possibility to not postpone the "uncheking" to the next day... I did that because I like to see my items checked (marked as done) as long as I need them to be checked. I don't like to check them and see them unchecked right away as my special formatting for done items goes away and it forces me to look at the "LastDone" field to see what has been done already.
 
I'll look at my script and see what can be done. (It'll  probably be easy .... just maybe some problem with the done field which I already experience when a past date it inserted in the done field).
 
If Pierre sees that and has another idea, well... I'm open to any suggestions.
 
[quote=reesd]
Also, if you can give me a bit more information on how auto update works for row equations I will update the doc. Doesn't seem to be any info for it in there. Is it basically they are run automatically at midnight or next time you log on if the day has changed?
[/quote]
 
The mechanism is simple : once a day, at midnight (I think it would be good if the user could choose the time himself though), all row equations set on Auto-update are recalculated. This most often NOT necessary. Each auto-update adds stuff to compute at midnight and so there must be good reasons for a field row equation to auto-update (examples of necessary fields : Urgency based on the date, Recurrence based on todays date and the done date, etc.).
 
The documentation I found (maybe not complete enough) :
 
-- link to nonexistent node ID 1071 --

Armando

2010/08/19 10:57

In reply to by reesd

Dave,
 
One thing that could be the problem : did you make sure that the "check" field has the "auto-update" ON for the row equation ?
You also need to have the proper UncheckOnRecur(Recurrence, check, done) function in your User Code (or database code, whatever you chose...)
 
My original instructions were :
 
 
Check
  • General
    • Properties
      • is "Done" field

      • CHECKED

         

  • Equations
    • Auto-assignment rules

    • 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 Equation

    • UncheckOnRecur(Recurrence, check, done)

       

      • Auto Update

      • CHECKED

         

         

        ========================

         

        Apart from that, I quickly looked at my own scripts etc. and there's no real difference. The only differences is that I changed grid captions for the fields by icons, and I implemented a function to lock the TaskActStart and TaskActEnd values for certain tasks I want to completely block (make them unmovable !)... So the check field has a few extra auto assigns etc.
         
        As I looked at the code I found that the name I chose for some fields completely stupid etc. I should change these, but it'd take some time to find all the dependencies in IQ since there's no integrated way to have the whole code (auto assigns, etc.) in one page. And... I don't really have a debugger handy so it makes it complicated... I'd have to own VB6 which is still sold and relatively expensive, believe it or not.
         
        One day I'll post the whole code for my project and task management solution, or might just meet Pierre and see if its valuable enough to be somewhat integrated in the default DB.

reesd

2010/08/23 19:22

In reply to by Armando

[quote=Armando]but it'd take some time to find all the dependencies in IQ since there's no integrated way to have the whole code (auto assigns, etc.) in one page. And... I don't really have a debugger handy so it makes it complicated... I'd have to own VB6 which is still sold and relatively expensive, believe it or not.[/quote]
 
Yeah, I would love to be able import/export fields. I posted on that in the old forum and I see you added it to mantis - http://mantis.sqlnotes.net/view.php?id=292. Perhaps we could at least add a simple way to export them to make documenting easier, which could be done much quicker than a full export/import facility.
 
Lack of a debugger is a problem also, it's why I gave up my own attempt at adding recurrence. Actually, I got it working but didn't realize I could use row equations to do the uncheck (I had tried circular auto-assignment rules which doesn't work).
 
If at least had some logging it would help, I asked for that in the old forum also and it made it to mantis - http://mantis.sqlnotes.net/view.php?id=174.
 
d
 
 

Armando

2010/08/23 23:19

In reply to by reesd

[quote=reesd]
[quote=Armando]but it'd take some time to find all the dependencies in IQ since there's no integrated way to have the whole code (auto assigns, etc.) in one page. And... I don't really have a debugger handy so it makes it complicated... I'd have to own VB6 which is still sold and relatively expensive, believe it or not.[/quote]
 
Yeah, I would love to be able import/export fields. I posted on that in the old forum and I see you added it to mantis - http://mantis.sqlnotes.net/view.php?id=292. Perhaps we could at least add a simple way to export them to make documenting easier, which could be done much quicker than a full export/import facility.
 
Lack of a debugger is a problem also, it's why I gave up my own attempt at adding recurrence. Actually, I got it working but didn't realize I could use row equations to do the uncheck (I had tried circular auto-assignment rules which doesn't work).
 
If at least had some logging it would help, I asked for that in the old forum also and it made it to mantis - http://mantis.sqlnotes.net/view.php?id=174.
 
d
[/quote]
 
Yes, the import/export of fields parameters would be good. And your intermediary solution seems like a good compromise. Pierre will certainly read and consider that.
 
As far as the debugging goes, one big step forward (Pierre mentioned that to me already I must say) would be to have a somewhat unified view of the whole user code + auto-assign equations, etc.
Note that some progress towards easier editing/scripting has appeared in the conditional formatting section : if you right click on the headers you can directly load/edit the text file for the conditional formatting which is great when you want to apply the same rules to different fields.

reesd

2012/05/23 13:33

In reply to by Armando

Thanks again for this Armando! I have it setup and working great using your updated steps in the first post.
 
d

jan_rifkinson

2012/05/23 18:13

In reply to by Armando

 Armando, Thanks for sharing this.
I actually need something like this for bills I have to pay regularly.
 
One question.
Before I muck around in an area where I'm mindlessly copying vbscript, i.e. I have no idea what I'm doing, will this type of recurrence be handled by updated calendar module?
And if so, will that interfere w this or visa-versa?
Thanks.

I found a typo in the UncheckOnRecur function. You have an "oh" rather than a "zero" where I have highlighted....
 
'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
 
 
If your interested, I wrote the following unit test around it using my assert functions (see unit testing vbscript functions).

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
 
 
And while looking at the code I realized that it would trigger even if it was done in the future. From your description I'm not sure that is what you wanted, so I switched it to the following (with an additional test for a done in the future):

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

 
 
d

jan_rifkinson

2012/05/24 15:08

In reply to by reesd

 Dave, for us programming dummies, could you post the entire correct code in one place? I am very interested in using this but am scared to death I'm going to screw something up. Thanks.

reesd

2012/05/25 11:26

In reply to by jan_rifkinson

I would use Armando's first post, he has kept it up to date. The one thing you need to change is that o to 0. My improvements are not that necessary I think, especially when you are just getting going.
 
If you like though, here is my dump of equations followed by my functions. I do wish there was an easier way to share these, maybe in the future Pierre will get a chance to revisit equations as he has mentioned. It would be great if all of this could be defined as module somehow.
 

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
 
Done (D): Item completed.
    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
 
 
DueDate (D):
    Assign:    AM:DueDatePast=formatdatetime(DueDate)
    Dependants fields:    StartDate,DueDateH
 
DueDatePast (T):
    Assign:    AM:DueDatesAllPast=addALLKeyword(DueDatesAllPast, DueDatePast)
 
DMY (T): Value   Time   / yyyy   =   Year / q        =   Qu
    Assign:    A:recurrence=-1|
        E:recurrence=
 
RecEvXDMY (N): Recurence : How many Days, Months or years after c
    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

 
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 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
 

jan_rifkinson

2012/05/25 13:10

In reply to by reesd

Dave, just so I am totally confident that I understand:
 
I insert the VBscript from "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"  to "End Function" via VBScript editor
 
and 
 
I create & add the directions to the new fields as described in your dump or Armando's first post. If I use yours I'm assuming that one o>0 correction has already been made. 
 
Do I have that right?
 
Thanks.

reesd

2012/05/25 15:42

In reply to by jan_rifkinson

Yup!
 
You can paste the VBScript in "This database" if you only want to use it in that database. After you paste it you need to click "Validate" and then "Save".

Armando

2012/06/05 15:14

In reply to by reesd

Sorry for the looooooong delay. I had too much work and couldn't drop by.
 
Thanks for the energy you put in trying to understand my scripts... This is something I put together relatively rapidly as I needed some kind of recurrence implementation.
 
I'm glad you found the "oh" vs  "0" problem. I don't know how it got there as my own script had a "0". Anyway... Maybe I corrected if along the way at some point and forgot to update my explanations here... or something like that.
 
I updated my first post.
 
As for your thoughts about done dates occurring in the future... I think I did that at first because I wanted the recurrence to happen whether it was marked as done in the future or not. I rely on another mechanism to block tasks from reappearing when I don't want to see them for a while ( a followupDate field which I use to filter tasks according to certain dates). I thought that preventing recurrence from happening because of some done date happening in the future could lead to head scratching like "Why isn't this task recurring as it should, every 2nd day ?".
 
But in any case, your interpretation of recurrence is as valid as mine. I guess that one could also set the done field as Read Only to prevent problems, as setting dates in the future for the done field is a strange strategy to begin with.
 
I haven't tried your test script, but it's clever and it encourages me to do more of these -- laziness !!  :)
 
Thanks and don't hesitate to propose any enhancement. I believe I made a few changes since the time I put it online, but nothing significant. Just added a field to the UncheckOnRecur equation -- a field I use to prevent a task to recur when I mark it as obsolete. Obsolete tasks are tasks that will eventually be completely deleted to free up space in the database. This absolutely unessential though, as one can just uncheck the recurrence field.
 
I'll  see if I have the time to look at the code and dump some changes here.
 
But it works as it is, right ?
 
 
--------------------------------------------------------------------------------
Windows XP Home Edition, Service pack 3
Dell Vostro 1500, Ram:3gb, CPU: Intel Core2Duo T7500 2.2ghz

Armando, Dave
 
Thanks for your help w this recurring thing.
I think I've got it working but won't know for sure until a few DueDates have been re-set. 
Once it kicks in, it will be a tremendous help simplifying my bills grid. 
 
Updated 05/29/12
Does the equation reset the due date immediately after midnight of the day the task is done (based on the d/w/m selected)
or does IQ wait for 
the # of d/w/m after duedate or after donedate to come due?
 
I know it's a convoluted question but I don't know how else to ask it. 
 

Armando

2012/06/05 15:16

In reply to by jan_rifkinson

Hi Jan, to see if the recurrence is functioning as it should, you could just uncheck tasks (or whatever item you're using recurrence with) manually, and see if the DueDate is changed accordingly.
Tell me if it works.
 
--------------------------------------------------------------------------------
Windows XP Home Edition, Service pack 3
Dell Vostro 1500, Ram:3gb, CPU: Intel Core2Duo T7500 2.2ghz

jan_rifkinson

2012/06/05 17:32

In reply to by Armando

working now, had to change another equation I had in a conflicting field. Not problem in your equation. Problem on my side.
Thanks for posting the equation, it is now saving me a lot of work  
I'm so jealous. I wish I knew how to write that stuff instead of being dependent on someone doing me a favor all the time.   

Armando

2012/06/05 18:32

In reply to by jan_rifkinson

I'm happy you got it working, Jan !
 
--------------------------------------------------------------------------------
Windows XP Home Edition, Service pack 3
Dell Vostro 1500, Ram:3gb, CPU: Intel Core2Duo T7500 2.2ghz

 Armando or Dave,
 
I looked up the word 'faculative' & from the definition, I take it that it is a field dependent on another field
Could one of you explain what populates the following fields, i.e. is it user input or automated. If automated, then by what field?
 
DueDate (faculative)
DueDatePast (faculative)
DueDatesAllPast (faculative)
 
And what about these two:
 
DoneLastDate
DoneAllDates
 
Thanks very much.

Armando

2012/08/05 10:35

In reply to by jan_rifkinson

Hi Jan,
 
Sorry for the late answer.
 
Facultative is just very very bad English on my part. Direct translation from French.
I wanted to write optional.
 
So... It's not a field, it's just meant to say that something is... optional.
 
Everything with optional appended to it can be skipped -- but if you include only one part marked as optional, all of the other optional ones need to be included too. (as described in the guide)


--------------------------------------------------------------------------------
Windows XP Home Edition, Service pack 3
Dell Vostro 1500, Ram:3gb, CPU: Intel Core2Duo T7500 2.2ghz

jan_rifkinson

2012/08/05 12:53

In reply to by Armando

 Thanks Armando