View Full Version : Plan: What is the value of blank Custom Data
cdpatnoe
01-09-2008, 04:54 PM
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
cdpatnoe
01-09-2008, 06:21 PM
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.
Lizard
01-09-2008, 06:23 PM
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
Tom Dibble
03-05-2008, 06:21 PM
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 ""!
RobTrew
03-06-2008, 08:47 PM
Empty record, i.e. empty list.
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
Lizard
03-07-2008, 12:05 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!)
RobTrew
03-07-2008, 02:43 PM
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)
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
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.