Home

Cardbox Talk

 

CardboxForumsCardbox Talk > "Timers on Cardbox"

Timers on Cardbox

I am looking to install a timer on Cardbox 3.0 to flag up entries which haven't been checked for a certain amount of time

Current user: [none]
Register / Log In · Help

Posted By Post

dstel

13-Mar-2008 10:16

I work for a small charity and we use Cardbox 3.0 to store information on research. I want to install a timer so that when an entry has not been updated for a certain amount of time (say 6 months or a year) it is flagged up. Is this possible? If so, could someone let me know how I could implement it?
Thanks.

Charles Welling

13-Mar-2008 10:43

First of all your records should be timestamped. i.e. they should contain the date on which they were last updated. You can use validation (Default entry) to set this up.
Your timer is nothing more than a simple selection that retrieves all records with update dates that precede the present date minus, for instance, 6 months.
For example, today is 13 March 2008 = 2008.03.13. Searching for ":2007.09.13" returns all records that haven't been updated in 6 months or more.
I guess you wouldn't want to do this 20 times a day, but perhaps once a week or month. In that case the above procedure is all the sophistication you'll need.

cardboss

17-Mar-2008 14:33

If you have the Professional Edition of Cardbox then you can create a macro that automates this selection command. You can then put it into your "Special" menu, so that the command "Special > Select Old Records" would select records that had a timestamp more than 6 (or 12) months old.

Charles Welling

18-Mar-2008 08:31

Assuming that the field that contains the date is called "MYDATE", the macro you would need is as follows.
Line 1 substracts 6 months from today, that's the "-6". Change the "m" into "y" if you want to substract years. If you change the number of months/years remember to use a negative number.
The date thus calculated is stored in the variable SearchDate.
Line 2 is not really necessary, but it reformats the date into yyyy.mm.dd, which may be useful if you want to automatically update the records. Change this if you use another format ("-" or "/").
Line 3 makes your selection.

SearchDate=DateAdd("m",-6,date)
SearchDate=DatetoCardbox(SearchDate,".")
Cardbox.Select "MYDATE",SearchDate

Helen

3-Nov-2009 14:19

I am trying to add a timer as described above but without much luck. I want to flag up records older than 12mths. i am using the / date format and the field is called LASDTE. my MACRO looks like this:

SearchDate=DateAdd("m",-12,date)
SearchDate=DatetoCardbox(SearchDate,"/")
Cardbox.Select "LASDTE",SearchDate

I am not sure how to use the Special menu, so have put it in Tools - Manage macros, and have added a pushbutton to activate it. It seems to run, but not find anything even though there are records older than a year in that field.

Any idea what I'm doing wrong?

Mary Doyle (DAF)

3-Nov-2009 15:31

A very quick reply - you could check the format you use to enter dates.
In a similar macro we use we specify the date format we use e.g.
x = DateToCardbox(Now,"4/7/1976")
StartDate = DateAdd("m","-3",x)
Cardbox.Select "dta",StartDate & ":" & x

bert

3-Nov-2009 17:13

One modification:

also startdate must be formatted!
So:
x = DateToCardbox(Now,"4/7/1976")
StartDate = DateToCardbox(DateAdd("m","-12",x),"4/7/1976")
Cardbox.Select "dta",StartDate & ":" & x
regards
bert

Helen

5-Nov-2009 10:06

Thanks . so, my macro now looks like this:

SearchDate=DateAdd("m",-12,date)
SearchDate=DatetoCardbox(SearchDate,"/")
Cardbox.Select "DATE1",SearchDate
x = DateToCardbox(Now,"4/7/1976")
StartDate = DateToCardbox(DateAdd("m","-12",x),"4/7/1976")
Cardbox.Select "dta",StartDate & ":" & x

but I am getting invalid field name message on line 3 character 1.

Would be grateful for further help.

Helen

Mary Doyle (DAF)

5-Nov-2009 13:04

Hi Helen,

In an earlier post you said the relevant field was named "lasdte". In the above example in Line 3 you are searching on a field named "Date1" and in line 6 you are searching on a field named "dta". You are also mixing 2 sample macros in the above. What format do you use in the "lasdte" field? Is the format consistent? You say you use "/" but is the format 4/7/1976 or 04/07/1976 or 04/07/76 etc.?

Regards,

Mary

Helen

6-Nov-2009 13:38

Thanks Mary,

I have amended the field names in the Macro. We are consistently adding the dates as 04/07/2009. Do I need to run these as separate macros?

Helen

Mary Doyle

9-Nov-2009 23:00

Hi Helen,

I have been away for a few days, hence the delay.
 
x = DateToCardbox(Now,"04/07/1976") ‘Gets today’s date in the format you use
StartDate = DateToCardbox(DateAdd("m","-12",x),"04/07/1976") ‘ Calculates 12 months previously
Cardbox.Select "lasdte",":" & StartDate
The last line is the equivalent of typing Search field LASDTE, :StartDate i.e. search for any records before the start date. For instance, if you were manually searching for records more than a year old you might type in the "Field" box LASDTE and in the "Search for box" :10/11/2008. In a macro using a variable (i.e. StartDate) you have to link what you would type : (which, being text, has to be in quotes in the macro) and the variable with the & symbol.

I hope this works for you and you can work out the logic.

Mary

Helen

10-Nov-2009 10:06

Thanks so much for all your help Mary, its working brilliantly now!

Helen

Quick Reply

Please log in or register before trying to post a reply.

 
© 2010 Cardbox Software Limited   Home