NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

IF condition doesn't seem to be working

Hi guys

I don't understand why my IF statement is not working. From the function I declare the variable "Word0 = Step.Result.String" 


Which yields "CAFE" in HEX

Andedam_0-1598256056219.png


I then use an IF statement to check the first two HEX of the Word0;

 

Andedam_2-1598256160855.png


Why is my IF statement returning false? As far as I understand, the syntax yields "no errors" and should check the Word0 for the First Two letters, to see if the word has 'CA' in the beginning, which it does

If Statement should yield "true"

Andedam_3-1598256184643.png

BR Andedam. Really hope some1 can enlighten me

 

0 Kudos
Message 1 of 5
(1,144 Views)

Hi,

 

The statement as is written above is correct so, the error should be somewhere else.I have isolated it in this example and it works for me.

Can you confirm that works for you as well?

0 Kudos
Message 2 of 5
(1,120 Views)

Hello again

Yes that sequence file is working for me. That's werid tho...

0 Kudos
Message 3 of 5
(1,113 Views)

Seems like the output comes with a space at the end

Andedam_0-1598270640853.png



If I change the condition to the word being 5 characters, it seems to be working.

What would be the easiest way of getting rid of the space characteR?

Thank you in advance !

0 Kudos
Message 4 of 5
(1,111 Views)

You can remove the last character of a string variable with this expression:

 

Locals.MyVariable=Left(Locals.MyVariable,Len(Locals.MyVariable)-1)

Message 5 of 5
(1,108 Views)