NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Array of strings

Is there a way to compare an array of strings in Teststand using a LV Coded Mod  ??  Do I have to create a local variable and put the data in there 1st ?
 
Thanks,
Clint
0 Kudos
Message 1 of 16
(6,077 Views)

Hey Clint,

Can you explain better what you want?  What I understand is that you have an array of strings in LabVIEW and one in TS and you want to compare the two?  Is that right? 

What is the purpose of comparing them?  Do you want to compare 1 element?  Or would you like to see if the entire arrays are equal?  And if so are you using it as a condition for something? 

Where are you getting the data from?

If you have two local arrays you could do this wherever conditions are accepted: Locals.Array1 == Locals.Array2  and that will see if they are equal.

Let me know some more details and I'll help you find the best solution.

Thanks

 

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 16
(6,072 Views)
I'm using TS as the Test Executive and LV 8.5 as the Module.  When I run LV the results are an Array of Stings.  I want to compare those, using TS, to a known value.  I know there is a single numeric limit, a boolean, an array of numerics, etc for comparison in TS just NOT an array of strings.  Couldn't find any examples either.
 
Thanks,
Clint
0 Kudos
Message 3 of 16
(6,040 Views)
Hi jigg
 
Sorry for jumping into your thread, but during lunch i figured out two simple solutions.
One uses the MultipleNumericLimitTest (!)  and the other a foreach Loop with StringValueTest
Check this out.
 
Note:
The loop will only work in TS4 or later!
 
Greetings
 
Juergen


Message Edited by j_dodek on 03-03-2008 06:28 AM
--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
Message 4 of 16
(6,034 Views)
Hey Clint,
 
You are correct.  There is not a step for multiple strings.  I'm assuming the reason you want this is for your report/database.  This is a good case where you would need to create a new step type. 
 
If you look at the Status Expression for the Pass/Fail, String or Numeric Limit steps then you'll see some weird expression.  This is what determines if the step passes or fails.  However, if you look at the status expression for the Multiple Numeric Limit Test then you'll notice that there's nothing in there.  So then you ask the question- How do we determine the pass fail status of the Multiple Numeric Limit test?  It is defined in the step definition properties.  So in your type palette go to NI_Types.ini and right click the NI_MultipleNumericLimitTest and select properties.  Click on the Substeps tab and you'll see two C substeps: DoMultiNumericMeasEvaluation... and EditMultiNumericMeasurement...  The DoMultiNumericMeasEvaluationUsingExpr function is a post substep that is actually doing the evaluation.  This function is part of the CommonSubsteps.dll  dll.  This dll is located here: C:\Program Files\National Instruments\TestStand 4.0\Components\NI\StepTypes\CommonSubsteps and contains the source code.  So basically you could mimick the Multiple Numeric Limit step except create new C++ code to evaluate the string arrays and determine the pass/fail status of your new step type.  This is kind of a major thing unless you are very familiar with C++.  Actually the substep doesn't have to be C++.  It could be LabVIEW.  It just has to accomplish the same thing as the substep.  The reason I explain all this is so you can at least understand what is involved.
 
Or you could create a step type that just compares two string arrays for the status expression.  So maybe copy the String Value test and then make Step.Result.String an array instead of just a string.  Add another array string subproperty that would be the one to compare with.  Then in the status expression compare the reult array with the constant subproperty.  This is kind of a hack.  But it's a lot easier than doing it the other way.
 
It looks like you aren't the only one interested in this kind of step type: http://forums.ni.com/ni/board/message?board.id=330&message.id=14995&requireLogin=False 
 
Maybe one of the AEs at NI would be up for the challenge for some EPD points.  Anyone?
 
Let me know if you have any questions about what I've explained or about the process.
 
Regards,
jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 5 of 16
(6,011 Views)

Maybe I'm making more out of this than need be.  I have a PXI Chassis w multiple PXI Cards.  I found an example (Develop Zone)  that you could query the cards over the back plane and find out their slot #.  I would look in MAX and verify that the returned slot # corresponded to the card I expected in that slot.  MFG was happy with this and I called it my "Health and Well ness Check".  It verified I could at least talk to a card before I began the Self Test.  I knew the slot from MAX and used that in TS to compare what I read in a LV Coded Module.  If they were equal the test passed.  I was able to do this with all my cards expect the PXI8433/2.  It returned COM3 and COM4 ( an Array of Strings) , not just Slot 1 or not just slot 2.   Thinking I could just do like an numericarray check only with strings I was happy.  But you can't.  This is where I am now.  I can save a lot of grief if I can just some how query the PXI8433/2 to make sure its "alive" before I do the self test.  Other wise I have to parse the string to get each of the com ports out of the string returned.

 

Go ahead make my day,

Clint

0 Kudos
Message 6 of 16
(6,005 Views)

BTW

I understood your first sentence and was lost after that !!  Smiley Wink

0 Kudos
Message 7 of 16
(6,001 Views)
Ha!  Sorry about that.  Sometimes I get carried away with explaining things too much.  I'll try and throw together an example for you.  But just to be clear.  You have an array coming back from your labVIEW module that contains two strings that are equal to Com1 and Com2?  You just need to verify that that's what the array contains right?  and then either pass or fail the step?
 
Thanks,
jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 8 of 16
(5,999 Views)
OK-
 
Here's the sequence and VI.  They are in TS 4.0 and LV 8.5.  Let me know if I need to back save them. 
 
Basically I used the Pass/Fail Test. Just because it's the easiest.  Then I change the Post Expression in the Properties to be:

Locals

.ReturnedArray == Locals.CompareArray ? Step.DataSource = True : "Step.Result.PassFail"

This assumes you have two local string arrays called ReturnedArray and CompareArray.  My VI returns an array that gets assigned to ReturnedArray.  CompareArray contains the values I want to compare the returned array with. 

The VI simply asks for two strings and then the user click the Done button to return the two strings as an array back to TS.

This is very much a hack but it seems to be working.

Let me know if you have any troubles or questions.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Download All
0 Kudos
Message 9 of 16
(5,994 Views)

Basically, yes.

Someone posted a TS Seq earlier that I haven't tried yet either. 

0 Kudos
Message 10 of 16
(5,975 Views)