These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

 FAQ Members List Calendar Search Today's Posts Mark Forums Read

 Plan: Data Calculations (custom column math) Thread Tools Search this Thread Display Modes
 Juljon Member 2008-03-12, 06:35 AM I would like to calculate data in Custom Fields. EG I have a number of budget hours to use on a task, I have to complete the task within a set time period. How many men are required to complete the task within budget? In mpp formulas can be inserted in the fields. Is there a way to do this in Omniplan?? Post 1
 Lizard Omni 2008-03-13, 10:22 AM There is no direct way to insert formulas into fields. However, it is possible to write an AppleScript that would take the value of one (or more) custom data fields for a task, perform some calculation on them, and write the result out as another custom data field for that task. This AppleScript could be designed to do calculations for the currently selected task, or each task in the project. The script can be added to your toolbar, for convenient updating of your file. Post 2
 Juljon Member 2008-03-13, 05:04 PM Thanks Lizard Could you direct me to where I could find out about Applescripts. I have no experience whatsoever with them. Post 3
 Lizard Omni 2008-03-14, 06:27 PM Here's Apple's official AppleScript reference: http://developer.apple.com/documenta...SLR_intro.html I actually find Matt Neuberg's book AppleScript:The Definitive Guide (O'Reilly) more helpful. Here's an example of an AppleScript that does approximately what I described above: Code: ```tell application "OmniPlan" repeat with t in tasks of front document if task type of t is standard task then -- effort is in seconds set budgetHours to (effort of t) / 3600 set budgetPrice to value of custom data entry "Budget Hour Price" of t if budgetHours is missing value or budgetPrice is missing value then set budgetTotal to 0 else set budgetTotal to budgetHours * budgetPrice end if set value of custom data entry "Budget Total" of t to budgetTotal end if end repeat end tell``` Post 4
 Juljon Member 2008-03-15, 06:21 AM Thanks Lizard, I've done some research and found a fair amount of information on the Apple website but it is quite involved and it seems to assume previous experience. The example you give is a big help to get me started - Thanks Post 5
Quote:
 Originally Posted by Lizard Here's an example of an AppleScript that does approximately what I described above:
Hey Lizard,

did you actually test that script? I get errors from the attempts to get the custom data entry values (and yes, I did create them in the project before running the script). I even tried it in a different user account just to make sure it wasn't something weird with mine (as some googling about for the error in other contexts suggested it might be). I'm using OP 1.5.1

 Lizard Omni 2008-06-29, 08:37 PM It is working for me without errors in OmniPlan 1.5.1 (with the columns created before running the script). If you could post the specific errors you're seeing here, or send them in an email to omniplan@omnigroup.com, I can try and see what's going awry for you. Post 7
Hi Lizard,
Say I have a custom field which is float (1.25) and I want to roll up/sum up the values of this custom field to its parent group, how do i do that.
By the way your script worked nicely to update the calculated field in custom data. Thanks

Quote:
 Originally Posted by Lizard Here's Apple's official AppleScript reference: I actually find Matt Neuberg's book AppleScript:The Definitive Guide (O'Reilly) more helpful. Here's an example of an AppleScript that does approximately what I described above: Code: ```tell application "OmniPlan" repeat with t in tasks of front document if task type of t is standard task then -- effort is in seconds set budgetHours to (effort of t) / 3600 set budgetPrice to value of custom data entry "Budget Hour Price" of t if budgetHours is missing value or budgetPrice is missing value then set budgetTotal to 0 else set budgetTotal to budgetHours * budgetPrice end if set value of custom data entry "Budget Total" of t to budgetTotal end if end repeat end tell```