Benches Uncategorized

2

Applescript returns incorrect value with blank ...

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

Imagine there is a column of numbers, some which might have the value 0.0 and some which are blank. Imagine wanting to append a data set at the first blank cell using Applescript. As Applescript is currently implemented in Numbers, this is not possible. See the following test.

1. In Numbers, create a new blank spreadsheet.
2. Select cell "A1".
3. Format as text.
4. Execute the following line of Applescript,
tell application "Numbers" to get value of cell "A1" of table 1 of sheet 1 of front document

It returns "0.0".
I would expect a return "" since it is a empty cell formated as text, no less.

Because of this, there is no way to find a blank cell since a blank cell returns a value of 0.0 which might be a valid entry.

Anyone have any ideas for a work around?

2 replies

Sign in or join Beachball Help to reply.

  1. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    The value of a blank (empty) cell IS zero.

    The value of a cell containing a string whose length is zero contains "".

    Given that, I will post a report because I'm not sure than the value returned in AppleScript is the good choice.

    In AppleWorks for a blank cell, the returned value was "".

    Yvan KOENIG (from FRANCE dimanche 11 janvier 2009 16:31:35)

    +Your tracking number for this issue is Bug ID# 6487875.+

    Hello

    +(1) May I know if the fact than+

    +set v to value of cell "B12"+
    +returns 0.0 when the cell is blank is the designed result.+

    +In AppleWorks in this case, we are accustomed to get an empty string.+

    +(2) In version 1, a cell containing an empty string was accepted in an arithmetic operation.+
    +In version 2, it is rejected.+
    +Is it a design choice or is it a bug ?+

    +Your tracking number for this issue is Bug ID# 6487879.+

    Hello

    +In Numbers, as long as we are referencing cells of the current row (200 for instance), we may use short references like:+
    =(BC)*(DE)

    +When we save as iWork '08 document, the formula is expanded as+
    =(B200C200)*(D200E200)

    +Is it a design choice or a bug ?+

  2. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Your welcome to your opinion, I'm welcome to mine. A blank cell contains nothing not 0.0. A value of 0.0 makes it impossible to write a script to find an empty cell.

    Additionally, Apple has changed the behavior of an empty cell, as displayed by the number of people's formulas, an existing function, that worked one way in '08 works another way in '09.

    Now, if you have a suggestion on how I can work around this problem I am more than willing to listen.