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
 whpalmer4 Member 2008-07-03, 10:06 PM I got it to work, not quite sure what the problem was, probably pilot error. I did notice that if I entered 0 for the Budget Hour Price, instead of getting a nice "0" in the Budget Total column, I got the rather funky "0e+0". Feedback submitted. Post 8
 Lizard Omni 2008-07-08, 11:24 AM whpalmer4: We haven't seen that behavior in-house, even with the example you sent in. If you're running Tiger, it's possible the behavior changed with Leopard. If you don't care about the decimal places on other values, you could cast a couple of the calculations to integers and see if that helps. Code: ` set foo to (x / y) as integer` Post 9
 whpalmer4 Member 2008-07-08, 07:22 PM I just confirmed that it still happens in the 1.6 SP under Tiger. I guess what you're implying is that you don't handle the formatting of these numbers? The script editor "debugger" does show the expected format, which makes it more interesting to me. In any case, I simply pointed it out because it looks ugly, and figured no one would argue otherwise. If I was an OmniPlan developer, I wouldn't be happy about it if I knew about it, unless it was something out of my control. It has no adverse impact on my ability to use OmniPlan, so I won't be inconvenienced in the slightest if you choose to do nothing. Post 10

 Similar Threads Thread Thread Starter Forum Replies Last Post workinprogress OmniPlan General 1 2011-07-27 02:08 PM morpheusmorph OmniFocus 1 for Mac 4 2011-05-19 10:05 AM rogbar OmniFocus 1 for Mac 2 2010-04-09 05:01 PM cdpatnoe AppleScripting Omni Apps 6 2008-03-07 01:43 PM RobTrew OmniFocus 1 for Mac 2 2007-08-23 05:26 AM

All times are GMT -8. The time now is 11:19 AM.

 -- Omni Style -- Lithographica Contact Us - The Omni Group Forums - Archive - Privacy Statement - Top