how can I find what value is in my variable?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Middletree

    how can I find what value is in my variable?

    At first glance, the question in the subject line seems way too easy. But I
    am finding some situations in my app where the value in a variable is some
    sort of blank-like value, such as Null or " " or "", but I cannot tell
    which.

    Of course, in order to find out the value, I did a response.write, and added
    a nonsense word afterward, to help make sure it is writing it out for me.

    First, I tried to check for null:

    if IsNull(strOrigV alue) then

    response.Write strOrigValue & "if"

    response.End

    else

    response.Write trim(strOrigVal ue) & "else"

    response.End


    end if

    =============== ===

    If not NULL, then perhaps it's blank, or a space. I tried this:

    if Trim(strOrigVal ue) = "" then

    response.Write strOrigValue & "if"

    response.End

    else

    response.Write trim(strOrigVal ue) & "else"

    response.End


    end if

    =============== ======

    In both cases, I ended up with "else" being displayed. I am at a loss here.
    Is there something else I can check for that will make it fall into the "if"
    part of the statement?


  • Dave Anderson

    #2
    Re: how can I find what value is in my variable?

    Middletree wrote:
    In both cases, I ended up with "else" being displayed. I am at
    a loss here. Is there something else I can check for that will
    make it fall into the "if" part of the statement?
    I would start here:

    Response.Write( TypeName(strOri gValue))




    You don't really say where this variable is coming from. Could you offer up
    some detail on how this variable gets populated?



    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms.


    Comment

    • Mike Brind

      #3
      Re: how can I find what value is in my variable?


      Middletree wrote:
      At first glance, the question in the subject line seems way too easy. But I
      am finding some situations in my app where the value in a variable is some
      sort of blank-like value, such as Null or " " or "", but I cannot tell
      which.
      >
      Of course, in order to find out the value, I did a response.write, and added
      a nonsense word afterward, to help make sure it is writing it out for me.
      >
      First, I tried to check for null:
      >
      if IsNull(strOrigV alue) then
      >
      response.Write strOrigValue & "if"
      >
      response.End
      >
      else
      >
      response.Write trim(strOrigVal ue) & "else"
      >
      response.End
      >
      >
      end if
      >
      =============== ===
      >
      If not NULL, then perhaps it's blank, or a space. I tried this:
      >
      if Trim(strOrigVal ue) = "" then
      >
      response.Write strOrigValue & "if"
      >
      response.End
      >
      else
      >
      response.Write trim(strOrigVal ue) & "else"
      >
      response.End
      >
      >
      end if
      >
      =============== ======
      >
      In both cases, I ended up with "else" being displayed. I am at a loss here.
      Is there something else I can check for that will make it fall into the "if"
      part of the statement?
      Try Response.Write TypeName(strOri gValue)

      If that doesn't light a bulb somewhere, show the code that generates
      the variable's value.

      --
      Mike Brind

      Comment

      • Mike Brind

        #4
        Re: how can I find what value is in my variable?


        Mike Brind wrote:
        Middletree wrote:
        At first glance, the question in the subject line seems way too easy. But I
        am finding some situations in my app where the value in a variable is some
        sort of blank-like value, such as Null or " " or "", but I cannot tell
        which.

        Of course, in order to find out the value, I did a response.write, and added
        a nonsense word afterward, to help make sure it is writing it out for me.

        First, I tried to check for null:

        if IsNull(strOrigV alue) then

        response.Write strOrigValue & "if"

        response.End

        else

        response.Write trim(strOrigVal ue) & "else"

        response.End


        end if

        =============== ===

        If not NULL, then perhaps it's blank, or a space. I tried this:

        if Trim(strOrigVal ue) = "" then

        response.Write strOrigValue & "if"

        response.End

        else

        response.Write trim(strOrigVal ue) & "else"

        response.End


        end if

        =============== ======

        In both cases, I ended up with "else" being displayed. I am at a loss here.
        Is there something else I can check for that will make it fall into the "if"
        part of the statement?
        >
        Try Response.Write TypeName(strOri gValue)
        >
        If that doesn't light a bulb somewhere, show the code that generates
        the variable's value.
        >
        Oh, and if the result of the above is Empty, check the spelling of the
        variable name where it gets its value assigned.

        --
        Mike Brind

        Comment

        Working...