You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

AppleScript Numbers: missing value test fails?

Environment:

    • Mojave, Numbers 6.1, Script Debugger 7
    • (found Script Debugger on line, seems helpful)


Code:

Log:


  1. For some, as yet unknown reason, despite the result being "missing value", the script dies on line 63 rather than skipping the block due to the test on line 62. Why?
  2. "Extra Credit" :-): Although this error (-10004) doesn't break the script, and the notification does get displayed, I'm curious why this error occurs and how to get rid of it.

MacBook Air

Posted on Jul 27, 2019 3:41 PM

Reply
Question marked as Top-ranking reply

Posted on Jul 27, 2019 6:22 PM

This should give you a clue why the test is working as you expect:




Note that the result is "missing value" and not missing value.


You've set rDate to be a string by using as string.


So you have to test for rDate being "missing value."


SG

Similar questions

5 replies

Jul 27, 2019 4:44 PM in response to astoller

Actually, I just figured out a difference - line 74 checks for missing value on the 'keyValue' string, and since that works (apparently) it doesn't actually hit line 77 to check for a missing value on the 'rDate' string.

If I create a data line that has the appropriate keyValue but no date string - it fails exactly like the 'if' clause -- so the issue seems to be with the test for missing value on a date string (even though it is being explicitly set to be a string).

Jul 28, 2019 8:13 AM in response to SGIII

BINGO! - That was the problem, it was coming back at the literal string "missing value" and not the figurative value. Putting quotes around the string in the test case(s) solved the problem.


FWIW, given my current data set, the timings for the two alternatives was:

-- Do date comparison then key match test (IF)
0:00:26.32
AppleScript 0:00:03.32 12.6%
Events 0:00:23.00 4916

-- Do key match test then date comparison (ELSE)
0:00:15.17
AppleScript 0:00:00.00
Events 0:00:17.54 4601

So, for now I'll do the key match first.

I now need to re-do my Automator script as a [just plain] Script, to see the performance of doing the insertion of the formula and then copying it over to verify that handling it all internally (above) is better in the long-run.


Thanks again SG - you are the King!

AppleScript Numbers: missing value test fails?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.