nbala75 Posted July 10, 2012 Share Posted July 10, 2012 (edited) I have been reading the help file and forum for a problem iam facing for 2 days now Even after searching, iam unable to figure out what exactly is wrong in my statement Pls help me If $tradelogTableData[4][$lastcol]=$aCellValue And $tradelogTableData[3][$lastcol]=StringLeft($dCellValue,1) _ And $tradelogTableData[5][$lastcol]<$cCellValue And ($tradelogTableData[6][$lastcol]=$LP or $tradelogTableData[6][$lastcol]=$TP) Then Msgbox(0,"","") Iam sure that there are some errors in "OR" part. I have even used brackets to force it. But still iam not getting it through. This seems to be simple but never works for me ! I tried this as well...this also doesnt work !! If $tradelogTableData[4][$lastcol]=$aCellValue And $tradelogTableData[3][$lastcol]=StringLeft($dCellValue,1) _ And $tradelogTableData[5][$lastcol]<$cCellValue Then If $tradelogTableData[6][$lastcol]=$LP or $tradelogTableData[6][$lastcol]=$TP Then Msgbox(0,"","") The input values which i checked using a msgbox just before these statements were: $tradelogTableData[4][$lastcol]=AAA $aCellValue= AAA $tradelogTableData[3][$lastcol]=S StringLeft($dCellValue,1) =S And $tradelogTableData[5][$lastcol]=209 $cCellValue=234 $tradelogTableData[6][$lastcol]=213.55 $LP =213.55 $tradelogTableData[6][$lastcol]=213.55 $TP=213.55 Edited July 10, 2012 by nbala75 Link to comment Share on other sites More sharing options...
Mechaflash Posted July 10, 2012 Share Posted July 10, 2012 I don't see a statement anywhere, I only see strings Did you forget your "if" ? If you didn't forget it in your actual code, then please post your actual code. Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
rvn Posted July 10, 2012 Share Posted July 10, 2012 simple example here ;if all true If 1 = 1 And 1 = 1 And 1 = 1 And (1 = 1 Or 1 = 1) Then ConsoleWrite("IF return TRUE" & @CRLF) Else ConsoleWrite("IF return FALSE" & @CRLF) EndIf ;if something false in "AND" If 1 = 0 And 1 = 1 And 1 = 1 And (1 = 1 Or 1 = 1) Then ConsoleWrite("IF return TRUE" & @CRLF) Else ConsoleWrite("IF return FALSE" & @CRLF) EndIf ;if something false in "OR" If 1 = 1 And 1 = 1 And 1 = 1 And (1 = 0 Or 1 = 1) Then ConsoleWrite("IF return TRUE" & @CRLF) Else ConsoleWrite("IF return FALSE" & @CRLF) EndIf ;Result ;IF return TRUE ;IF return FALSE ;IF return TRUE is this what u want?! Link to comment Share on other sites More sharing options...
nbala75 Posted July 10, 2012 Author Share Posted July 10, 2012 I don't see a statement anywhere, I only see strings Did you forget your "if" ?If you didn't forget it in your actual code, then please post your actual code.Not copy pasted correctly....edited now Link to comment Share on other sites More sharing options...
nbala75 Posted July 10, 2012 Author Share Posted July 10, 2012 simple example here ;if all true If 1 = 1 And 1 = 1 And 1 = 1 And (1 = 1 Or 1 = 1) Then ConsoleWrite("IF return TRUE" & @CRLF) Else ConsoleWrite("IF return FALSE" & @CRLF) EndIf ;if something false in "AND" If 1 = 0 And 1 = 1 And 1 = 1 And (1 = 1 Or 1 = 1) Then ConsoleWrite("IF return TRUE" & @CRLF) Else ConsoleWrite("IF return FALSE" & @CRLF) EndIf ;if something false in "OR" If 1 = 1 And 1 = 1 And 1 = 1 And (1 = 0 Or 1 = 1) Then ConsoleWrite("IF return TRUE" & @CRLF) Else ConsoleWrite("IF return FALSE" & @CRLF) EndIf ;Result ;IF return TRUE ;IF return FALSE ;IF return TRUE is this what u want?! I do see something like this works...but mine(in my first post) is also similar...why it doesnt work?? $A=1 $B=1 $c=5 $D=5 $E=10 $F=10 $G=100 $LP=100 $TP=500 ;if all true If $A = $B And $c = $D And $E = $F And ($G = $LP Or $G = $TP) Then ConsoleWrite("IF return TRUE" & @CRLF) Else ConsoleWrite("IF return FALSE" & @CRLF) EndIf Link to comment Share on other sites More sharing options...
rvn Posted July 10, 2012 Share Posted July 10, 2012 "why it doesnt work??", well it work for me... nothing wrong with the logic, or maybe that script is not what you need Link to comment Share on other sites More sharing options...
John Posted July 10, 2012 Share Posted July 10, 2012 If any of those variables are returning a value that is padded with a whitespace new line character will fail. Such characters will not be visible on a MsgBox either. I sometimes, for debugging, append characters before and after variables that look right but might not be. Such as: MsgBox(0,"","|" & $var & "|") This will make spaces and such visible. Link to comment Share on other sites More sharing options...
rvn Posted July 10, 2012 Share Posted July 10, 2012 If any of those variables are returning a value that is padded with a whitespace new line character will fail. Such characters will not be visible on a MsgBox either. I sometimes, for debugging, append characters before and after variables that look right but might not be. Such as: MsgBox(0,"","|" & $var & "|") This will make spaces and such visible. ofcourse it is not. its all about parsing the string to "IF" decision... here for example ; example right logic but wrong implementation $var = " " & @CRLF & " " ;ConsoleWrite("'" & $var & "'" & @CRLF) $var = StringStripWS($var, 1+2) ;ConsoleWrite("'" & $var & "'" & @CRLF) If $var = @CRLF Then ConsoleWrite("IF return TRUE" & @CRLF) Else ConsoleWrite("IF return FALSE" & @CRLF) EndIf ; example right logic and right implementation $var = " " & @CRLF & " " ;ConsoleWrite("'" & $var & "'" & @CRLF) $var = StringTrimRight($var,1) $var = StringTrimLeft($var,1) ;ConsoleWrite("'" & $var & "'" & @CRLF) If $var = @CRLF Then ConsoleWrite("IF return TRUE" & @CRLF) Else ConsoleWrite("IF return FALSE" & @CRLF) EndIf ;Result ;IF return FALSE ;IF return TRUE Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now