Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
New Member
lion
Posts: 2
Country: Poland
Message 1 of 3 (1,252 Views)

Recurring Activities for Report Plugin

Hello,

 

I'm developing a plugin for ACT! 2008 which should do such things:

 

- get all activities for current user by organizeuserid

- create a HTML page which should look similar to ACT! report, with some changes in grouping and sorting

 

The user should determine the timespan of reports (with DateTimePickers) and grouping methods but it is not that important now.

My problem lies in recurring activities. Typically, the ACT! report shows all occurences of recurring activities and that is what I also want to achieve, but now I can only get the activity itself and not all the occurences. I examined the ACT! Database structure and I have such a conclusion - it can be achieved by writing methods in VS calculating all occurence dates, but with all this dependencies (for instance - second thursday of march, monday and tuesday every week, etc.) writing such a program will be quite hard (I'm new in ACT! programming and mid-experienced in .NET). So my question is that - is there any easier solution that allows me to get all the occurencies of recurring activities in a particular period of time (for example, this month)? Something in ACT! SDK maybe, or direct from database itself?

 

 

Please use plain text.
Employee
mwood
Posts: 1,163
Country: USA
Message 2 of 3 (1,209 Views)

Re: Recurring Activities for Report Plugin

[ Edited ]

The GetActivites methods don't filter out recurring activities unless you choose to via filter criteria. So for instance :

 

ActivityList al =
                ActApp.ActFramework.Activities.GetActivitiesForContact(ActApp.ApplicationState.CurrentContact, FirstInstanceRestriction.None);

 

Will return every activity for the current contact regardless of whether it recurs or not, along with all of the occurrences of that activity within a time period that can also be specified via overloads for this method

 

GetActivitiesForContact(ActivitySortCriteria,IActivityFilterCriteria[],IActivityFilterCriteria[],Contact,DateTime,DateTime,FirstInstanceRestriction)

 

Also for your question regarding the type of reccurence can be answered via properties of the activities you capture in the activity list, Activity.RecurSpec will give the specifics of the rucurrence type, ie. Every Wednesday @ 6:00 untill 11/26/2010.

 

This might be helpful as well, I put together a string showing all the data that is returned when you requrest the various recur properties of an activity


---------------------------
RecurCount: 12

RecurDay: 8

RecurDayType: Named

RecurEndDate: 11/26/2009

RecurFreq: 1

RecurModifier: None

RecurMonth: 0

RecurPeriod: Weekly

RecurSpec: Occurs every Wednesday until 11/26/2009.
---------------------------


Edit

After reading back through I think I might have failed to answer your question on getting all the occurrences of a particular recurring activity within a giving time period. Since they'll all have the same EventName, you can just trim down your activity list within a given time period where EventName== the EventName property of the reoccuring activity your looking for. There are other comparators you could use as well, but EventName seemed the easiest.

 

Hope this helps.

 

Matthew Wood
Act! SDK Support
Community Moderator
Please use plain text.
New Member
lion
Posts: 2
Country: Poland
Message 3 of 3 (1,163 Views)

Re: Recurring Activities for Report Plugin

Matthew, thank you for your help. It seems that the method you provided works brilliant with appropriate filters. I have developed a solution without it (using SQL connections to ACT! database and solution I mentioned) but now I can write something with shorter code.

 

I also wonder, why some field descriptors are connected to the tables I cannot see in the database. For instance, descriptor Activity.OccurDate refers to a table dbo.TBL_ACTIVITY_OCCURRENCES, which is not shown in table list in SQL Server Management Studio. Can somebody explain, why?:smileyhappy:

Please use plain text.