equals empty

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • boudie
    Forum Member
    • Jun 2003
    • 3

    equals empty

    I am having a problem with checking if a variable is empty. This is what i try to do.

    During a installation a user is browing to the path of a log directory. The way the log directory is being put in a variable would be like this D:\msiislog\w3svc1 (%LogDir) (The directory depth can also be deeper if the user has the log directory there ofcourse) The variable %LogDir% can not be put into a conf file right away, cause this conf file needs to read the string with only "/" and not "\" So i have to replace the forward slashes, with back slashes. The way i am trying it now is like this.

    I use the "get delimited string" with "\" as the delimiter. I use this like 7 times with moving 1 item index up every time. So the first 3 times it is doing it, it will get this if we stick to the "D:\msiislog\w3svc1" as an example
    D:
    msiillog
    w3svc1
    I assigned a value to a variable to insert a forward slash
    %+/% with value /
    I also assigned a value to a variable with nothing in it and called it %empty% (i also tried this with a space and "")
    When doing the "get delimited string" fot the 4th time, it does not find anything, since the target directory msiislog is the last (3rd) so that makes sense to me.

    Then i am using the IF statement to see if the variables i collected with the "get delimited string" is NOT equal to empty. If it's not empty then write to a logfile and add the %+/% to it. It looks like this:
    IF %StringItem% <> %empty%
    Wite to text file blah blah (also puts the "/" to it with the %+/%)
    END IF
    IF %StringItem1% <> %empty%
    Wite to text file blah blah (also puts the "/" to it with the %+/%)
    End IF
    and so on.....
    So when it comes to a %StringItem% that is empty (after the 3rd one w3svc1) it should go to END IF and hops all the way down to the last one.
    When i check the txt file it has been written to it nicely what i want, but it has put the "/" behind the empty checks aswell. It looks like this
    D:/msiislog/w3svc1/////
    So what am i doing wrong. I was trying to let it check on a empty string, it empty, then skip to write ot file, but yet it writes to file. I am pretty sure it goes wrong with the empty check, but how can i change this. Hope anyone can help me, and hope i made myself a bit clear in hear so it still makes any sense. Thanks.

    BTW, i also tried it before to check on "length of string" but i didnt get any valid returns from that. If i checked on the word "msiislog" i expected the value 8 but it kept giving me back 0, so i couldnt check on = 0


  • Darryl
    Indigo Rose Staff Member
    • Jul 2001
    • 1908

    #2
    Re: equals empty

    Hi Boudie,

    Just to let you know, I replied to your email yesterday morning, so if for some reason you did not receive it, let me know and I'll send it again.

    Comment

    Working...
    X