Marketcircle Home Products Support Blog Forums Partners Store
Marketcircle    Forums  Hop To Forum Categories  Extending Daylite  Hop To Forums  Building Reports and Print Layouts    Activity Time By Category - Select User/Project
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Apprentice
Posted
Hello,

i would like to change the "Activity Time By Category - Select User" report so that i can select the project instead of the user.
So far i managed to change the userInput to get the selected project. But where i need help is in changing the script for the table. here is the orginal script in the data field of the table:

userTask := element valueForKeyPath:'userInput.selectedUser.userID'.
startDate := element valueForKeyPath:'userInput.startDate'.
endDate := element valueForKeyPath:'userInput.endDate'.
start := startDate dateAsBeginningOfDay.
end := endDate dateAsEndOfDay.

qual1 := BDKeyValueQualifier keyValueQualifierWithKey:'startDate' operatorSelector:#isGreaterThan: value:start.
qual2 := BDKeyValueQualifier keyValueQualifierWithKey:'completeDate' operatorSelector:#isLessThan: value:end.
qual3 := BDKeyValueQualifier keyValueQualifierWithKey:'assignedToID' operatorSelector:#isEqualTo: value:userTask.

qualifiers := {qual1, qual2, qual3}.

andQual := (((BDAndQualifier alloc) initWithQualifierArray:qualifiers) autorelease).

tasks := objectContext objectsForEntityNamed:'Task' matchingQualifier:andQual.



taskCategories := tasks valueForKeyPath:'category.name'.



user := element valueForKeyPath:'userInput.selectedUser'.

doc := objectContext document.


timeblocks := doc calendarObjectsFromDate:start
toDate:end
forOwner:user
timedType:1.

appointments := timeblocks.



apptCategories := appointments valueForKeyPath:'category.name'.


apptCategories == nil ifTrue:
[
apptCategories := {}.
].

taskCategories == nil ifTrue:
[
taskCategories := {}.
].


allCategories := apptCategories ++ taskCategories.



allCategoriesWithRemovedDuplicateNames := allCategories distinct.

categoriesCount := allCategoriesWithRemovedDuplicateNames count.



taskCount := tasks count.
appointmentsCount := appointments count.

x := 0.


glossary := NSMutableDictionary dictionary.
finalNewArray := {}.



[ x < categoriesCount ] whileTrue:
[
categoryName := allCategoriesWithRemovedDuplicateNames at:x.


categoryName == NSNull null ifTrue:
[
categoryName := 'No Category'.

].


z := 0.
arrayOfTasksWithCategory := {}.
arrayOfApptsWithCategory := {}.

taskCount == nil ifTrue:
[
taskCount := 0.
].


[ z < taskCount ] whileTrue:
[
singleTask := tasks at:z.
singleTaskCategoryName := singleTask valueForKeyPath:'category.name'.

singleTaskCategoryName == nil ifTrue:
[
singleTaskCategoryName := 'No Category'.
].


categoryName = singleTaskCategoryName ifTrue:
[
arrayOfTasksWithCategory insert:singleTask at:0.
].
z := z + 1.

].

arrayOfTasksDurationInSeconds := arrayOfTasksWithCategory valueForKeyPath:'durationSeconds'.

totalTasksSeconds := arrayOfTasksDurationInSeconds \ #+.

tasksWithCategoryCount := arrayOfTasksWithCategory count.


y := 0.
[ y < appointmentsCount ] whileTrue:
[
singleAppt := appointments at:y.
singleApptCategoryName := singleAppt valueForKeyPath:'category.name'.

singleApptCategoryName == nil ifTrue:
[
singleApptCategoryName := 'No Category'.
].

categoryName = singleApptCategoryName ifTrue:
[
arrayOfApptsWithCategory insert:singleAppt at:0.
].
y := y + 1.
].
arrayOfApptsDurationInSeconds := arrayOfApptsWithCategory valueForKeyPath:'durationSeconds'.


totalApptsSeconds := arrayOfApptsDurationInSeconds \ #+.

apptsWithCategoryCount := arrayOfApptsWithCategory count.



totalTasksSeconds == nil ifTrue:
[
totalTasksSeconds := 0.
].

totalApptsSeconds == nil ifTrue:
[
totalApptsSeconds := 0.
].

totalApptsAndTasksDurationInSecondsForCategory := totalTasksSeconds + totalApptsSeconds.


totalApptsAndTasksCountForCategory := tasksWithCategoryCount + apptsWithCategoryCount.



glossary := NSMutableDictionary dictionary.
glossary setObject:categoryName forKey:'categoryName'.
glossary setObject:totalTasksSeconds forKey:'totalTasksSeconds'.
glossary setObject:totalApptsSeconds forKey:'totalApptsSeconds'.
glossary setObject:tasksWithCategoryCount forKey:'tasksWithCategoryCount'.
glossary setObject:apptsWithCategoryCount forKey:'apptsWithCategoryCount'.
glossary setObject:totalApptsAndTasksDurationInSecondsForCategory forKey:'totalApptsAndTasksDurationInSecondsForCategory'.
glossary setObject:totalApptsAndTasksCountForCategory forKey:'totalApptsAndTasksCountForCategory'.

finalNewArray insert:glossary at:x.

x := x + 1.

].


finalNewArray.


can someone help me. that would be so cool. i am starting a video production company right now and would like to use daylite for analysing projects.

thanks rocky
 
Posts: 1 | Registered: October 08, 2008Reply With QuoteEdit or Delete MessageReport This Post
Apprentice
Posted Hide Post
hello,

have a look at my report in this post
http://forums.marketcircle.com/eve/forums/a/tpc/f/9341001833/m/4511098765
i didn't do it with a script, but with the build in standard filter system.
works great.

i also created the user input, but i'm still trying to have only the open project in the dropdown (my list is getting a bit long...)


pieter lesage
partner - designer
concrete, all-round creative
www.concrete.be
 
Posts: 30 | Location: antwerp/belgium | Registered: June 18, 2007Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

Marketcircle    Forums  Hop To Forum Categories  Extending Daylite  Hop To Forums  Building Reports and Print Layouts    Activity Time By Category - Select User/Project

 

Refund Policy | Privacy Policy | Site Map | About Marketcircle
©2008 Marketcircle Inc. All rights reserved.
webmaster@marketcircle.com