NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Syntax Error while using FindIndex in TestStand Functions

Solved!
Go to solution

Hi All,

I used this function long before which was working for me, but not sure what i am doing wrong not able to get my work done.

 

This is my scenario,

I have a Local variable  1D array of String assume (Locals.XXX)

i need to get First element value

I used the Below syntax

FindIndex(Locals.XXX,1,True)

TestStand Error.PNG

 

 

Advice me what i am doing wrong

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 1 of 9
(5,626 Views)

Hi Palanivel,

 

Is the array an array of strings?  Perhaps you should use

 

FindIndex(Locals.XXX,"1",True)

Regards,

 

Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)

Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor

0 Kudos
Message 2 of 9
(5,623 Views)

I tried this but i am getting Empty value instead of 1st Index Value

FindIndex(Locals.XXX,"1",True)

 

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 3 of 9
(5,618 Views)

The FindIndex function returns the index as a string, formatted as "[i][j][k]"; are you trying to use this or are you expecting a numeric index to be returned?

 

To get a numeric index, use the following expression:

IndexToOffset(Locals.Array, FindIndex(Locals.Array,"1",True))

Regards,

 

Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)

Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor

0 Kudos
Message 4 of 9
(5,614 Views)

Hi Charlie

Thanks for the update,

I need the Index Value assume My Locals.Array contains values as ["asd","fgh","jkl","qwe","rty","uio"]

If my index value is 1 then i need the output as "fgh"

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 5 of 9
(5,609 Views)

Hi Palanivel,

 

See the attached example.

Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)

Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor

Message 6 of 9
(5,607 Views)

Hi Charlie

Its Working Vice Versa i can able to retrive my index for my Index Vaue  which is same as Search 1D Array in labVIEW Functions.

My requirement is to work as same as Index array in labVIEW

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 7 of 9
(5,603 Views)
Solution

Thanks Charlie

 

I will use an alternative Method for the same requirement

 

Locals.MyArray[4] instead of Find Index

 

Kudos to your support!

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
Message 8 of 9
(5,581 Views)

No problem - glad I could help!

Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)

Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor

0 Kudos
Message 9 of 9
(5,577 Views)