The Omni Group
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!

Go Back   The Omni Group Forums > Developer > AppleScripting Omni Apps
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Plan: What is the value of blank Custom Data Thread Tools Search this Thread Display Modes
Hi there,

I'm writing a script that to populate some Custom Data into an OmniPlan document, but I want it only to fill in the custom data is blank.

Problem is I don't seem to be able to match against empty data

set OPBug_ID to the value of custom data entry "Bug ID" of this_task

Using Script Debugger, this custom Bug ID shows "missing value" as the value of OPBug_ID.

When I do an AppleScript Display Dialog, it prints "msng". When using say, it says "m""s""n""g".

Neither "missing value" nor "msng" will allow a match in AppleScript. Am I missing something really simple here?

Thanks!

Christopher
 
figured an easy way around it...

set OPBug_ID to the value of custom data entry "Bug ID" of this_task as string

so by setting "missing value" as a string, I'm able to match against it.
 
It's not what you're missing, it's what you've added -- the quotation marks!
The following should work:
if OPBug_ID is missing value
-- no bug id
else
-- do something with the bug id
end if
 
Quote:
Originally Posted by Lizard View Post
It's not what you're missing, it's what you've added -- the quotation marks!
The following should work:
if OPBug_ID is missing value
-- no bug id
else
-- do something with the bug id
end if
That doesn't work for me. I have to get the custom data value "as string" then compare it to ""!
 
Empty record, i.e. empty list.

Code:
tell application "OmniPlan"
	set oTask to child task 1 of document 1
	set recData to custom data of oTask
	if recData = {} then display dialog "Empty"
end tell

Last edited by RobTrew; 2008-03-06 at 11:25 PM..
 
RobTrew: I can't get your suggestion to work on OP 1.5 once I define a custom data key, even if the value for a specific task is not specified.

I'm puzzled, because the code I posted above still works for me in both Script Editor and Script Debugger. Perhaps the behavior changed between OmniPlan 1.1.2 and 1.5?

(If you're not running 1.5 yet, I encourage you to get the upgrade -- it's free!)
 
Yes the previous code only reports a condition in which no custom data key exists.

The following catches missing data for an existing key (in 1.5)

Code:
tell application "OmniPlan"
	set oTask to item 1 of child tasks of document 1
	set recData to custom data of oTask
	
	set varValue to |OPBug_ID| of recData
	
	if varValue is missing value then
		display dialog "Empty !"
	else
		display dialog (varValue as string)
	end if
	
end tell
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Plan: Data Calculations (custom column math) Juljon AppleScripting Omni Apps 12 2012-05-05 04:44 AM
Can custom data be printed jethiele OmniPlan General 5 2012-04-20 11:27 AM
Project Custom Data jotapes OmniPlan General 13 2011-11-29 08:46 AM
Custom data didn't migrate to 2.0? workinprogress OmniPlan General 1 2011-07-27 03:08 PM
Searching custom data edwagner OmniPlan General 1 2010-09-17 10:19 PM


All times are GMT -8. The time now is 03:44 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.