SPONSORS:






User Tag List

Results 1 to 6 of 6
  1. #1
    Senior Member
    Join Date
    Jul 2002
    Location
    Paris (France)
    Posts
    182
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Checking for unset of a LIST?

    When using a LIST OF STRING, how do you check for the variable being "<unset>"?

    Here are the details:

    I have a LIST OF STRING defined as lsData. I am reading a table row using the GetRowText(iRow) function. Now, if the cells of the row are empty, GetRowText() returns <unset>. That is fine, but I am also placing all rows into another LIST to cycle through and use at a later time.

    So, what I am looking to do is something like:

    But, that doesn't work, checking agaisnt NULL, {}, another unset LIST - none actually made the code take the IF..THEN path.

    So, again, the question is: How do you check for the <unset> condition?

    ------------------
    David Genrich
    Icarian
    555 North Mathilda Ave
    Sunnyvale, CA 94086
    davidg@icarian.com

    [This message has been edited by davidg (edited 02-28-2000).]

  2. #2
    Senior Member
    Join Date
    Jul 1999
    Location
    Columbus, OH, USA
    Posts
    689
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Checking for unset of a LIST?

    You could write a function that checks to see if the list is empty.


    [This message has been edited by Damian Synadinos (edited 02-28-2000).]

  3. #3
    Senior Member
    Join Date
    Jul 2002
    Location
    Paris (France)
    Posts
    182
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Checking for unset of a LIST?

    Tried that already. Problem is, when a list is empty, it isn't equal to an empty string, it is unset (like declaring a variable but not setting it to anything).

    I even tried setting the list variable to an empty string before getting the data (lsData = {"", ""}), but when the row is read, lsData is reset to "<unset>".

    I did find a workaround, but not an anwser:

    This works by skiping over the unset rows. Not as clean as I would like it, but a workaround until I can find a better solution.


    ------------------
    David Genrich
    Icarian
    555 North Mathilda Ave
    Sunnyvale, CA 94086
    davidg@icarian.com

  4. #4
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Checking for unset of a LIST?

    Have you tried using debug to examine the type and value supplied for each of the returned cells?

    I would think that an empty column in an otherwise occupied row might be a useful clue to the return value of a completely empty row. (Have you tried using a record?)

    When a list is empty its value is {} - an open and close brace with no intervening character.

    An interesting puzzle ...

    John

  5. #5
    Senior Member
    Join Date
    Jul 2002
    Location
    Paris (France)
    Posts
    182
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Checking for unset of a LIST?

    1. For the problem rows, the returned value that the debug says is: <unset>

    2. The rows are not occupied, but being used as spacing. The table will change the number of rows based on what it is used for (such as, if (dat_exists), display HTML row with data). So, I am getting the total number of rows, then cycling through each row to get the data in a format that I can easily use it.

    3. Tried (and I am) using a record. But, the data still comes into a LIST OF STRING first since since that is what the GetRowText() function returns. But, since the cells are empty, it isn't returning an empty string, but rather an unset variable. Setting the record to the unset value causes an except, since the value is unset.

    4. I have tried to compare the returned value to {}, no luck. I have also tried to decare a test variable that is unset, then use the returned variable and the test varaible as the test condition - didn't work.

    So, like I said, I found a workaound by using a controlled Do..Except, but that doesn't answer the question on how to check for an unset variable.




    ------------------
    David Genrich
    Icarian
    555 North Mathilda Ave
    Sunnyvale, CA 94086
    davidg@icarian.com

  6. #6
    Guest

    Re: Checking for unset of a LIST?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by davidg:
    So, like I said, I found a workaound by using a controlled Do..Except, but that doesn't answer the question on how to check for an unset variable.
    <HR></BLOCKQUOTE>

    There is a built-in function called IsSet() that sounds like it would solve your problem. Here is the text from the SilkTest online help.

    IsSet Function

    Action

    Tests whether a variable has been assigned an initial value.

    Syntax

    bTest = IsSet (aVar)

    Variable Description
    bTest TRUE if the variable has been assigned. BOOLEAN.
    aVar The variable to check. ANYTYPE.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 10:48 AM.

Copyright BetaSoft Inc.