NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How does the TS_SeqFileSequenceNameExists() function work?

I am creating a TestStand Sequence file using CVI and would like to know the correct syntax for using the TS_SeqFileSequenceNameExists() function.

Basically what I'm trying to do is add a sub sequence to my file and if the sequence name already exists, change the name. So the code looks something like this:

if(!(TS_SeqFileSequenceNameExists(seqFile,NULL,subSequenceName,&myTempVBool)))
{
//sub sequence doesn't exist... add it
}
else
{
//subsequence name already taken, change the name
}

Thanks,
Marek D.
0 Kudos
Message 1 of 3
(2,888 Views)
Hi Marek,
you're logic is a little out - in your example code you are testing the error, not the bool "myTempVBool"
so something more like

(TS_SeqFileSequenceNameExists(seqFile,NULL,sub SequenceName,&myTempVBool));

if(myTempVBool == VFALSE)
{
//sub sequence doesn't exist... add it
}
else
{
//subsequence name already taken, change the name
}


NOTE :
You need to rename the object BEFORE you try to insert it. Have a look at the help file on
SequenceFile.InsertSequence where it says about the sequence must not already exist in the file. (Also don't forget to release the clone object when you've finished)

Have a look at your other question on "How do I change the name of a sub sequence using CVI" , I've included an example there which shoul
d help you out.

S.
// it takes almost no time to rate an answer Smiley Wink
Message 2 of 3
(2,888 Views)
Hi Marek D,

Here is a quick code snippet you can use with the TS_SeqFileSequenceNameExists function:

status = TS_SeqFileSequenceNameExists (hSeqFile, NULL, "MainSequence", &result);

if(result) {/*sequence exists, use different name*/}
else {/*sequence doesn't exist, so add it*/}

The above code snippet assumes you have a valid handle to the sequence file in the variable "hSeqFile", that you are looking for the sequence "MainSequence", and you have declared a VBOOL named "result" to store the result of the function call in. As you can see the main problem with your code is that you are basing your condition on the returned error code of the function instead of the boolean value that indicates if the sequence exists or not.

Jason F.
Applications Eng
ineer
National Instruments
www.ni.com/ask
Message 3 of 3
(2,888 Views)