Jump to content

Why doesn't my if statement work?


BatMan22
 Share

Recommended Posts

Why doesn't my first if statement below work? The rest work great. Can you not use "&" in a if statement? Is there a work around for that? 

Global $ColumnC[5]
Global $ColumnB[5]

Global $testcodeIC1="300.1"
Global $testcodeIC2="218.6"
Global $testcodeIC3="poop"



$ColumnC[0] = "300.1"
$ColumnC[1] = "300.0"
$ColumnC[2] = "poop"
$ColumnC[3] = "zomgnewtestcode"
$ColumnC[4] = "300.1"
$ColumnB[0] = "Sample1"
$ColumnB[2] = "Sample2"
$ColumnB[3] = "Sample3"
$ColumnB[4] = "Sample4"
$ColumnB[4] = "Sample5"

For $i = 0 To UBound($ColumnC) - 1 ;should write zomgnewtestcode to the unknown file, eventually this will prompt me to assign it to IC1, 2, or 3. But for now I just want to debug why the IF statement isn't working.
    If $ColumnC[$i] <> $testcodeIC1 & $ColumnC[$i] <> $testcodeIC2 & $ColumnC[$i] <> $testcodeIC3 Then
        FileWrite(@ScriptDir & "\ICUNKNOWN.txt", $ColumnB[$i] & " " & $ColumnC[$i] & @CRLF)
    EndIf
Next

For $i = 0 To UBound($ColumnC) - 1
    If $ColumnC[$i] = $testcodeIC1 Then
        FileWrite(@ScriptDir & "\IC1.txt", $ColumnB[$i] & " " & $ColumnC[$i] & @CRLF)
    EndIf
Next

For $i = 0 To UBound($ColumnC) - 1
    If $ColumnC[$i] = $testcodeIC2 Then
        FileWrite(@ScriptDir & "\IC2.txt", $ColumnB[$i] & " " & $ColumnC[$i] & @CRLF)
    EndIf
Next


For $i = 0 To UBound($ColumnC) - 1
    If $ColumnC[$i] = $testcodeIC3 Then
        FileWrite(@ScriptDir & "\IC3.txt", $ColumnB[$i] & " " & $ColumnC[$i] & @CRLF)
    EndIf
Next

 

Edited by BatMan22
Link to comment
Share on other sites

& is a string concatenator according to the help file.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...