NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I change the name of a sub sequence using CVI

Hi,

I've used the clone property function to clone a sequence from one sequence file and I've inserted it into another sequence file. I'd like to rename the sequence now to a different name.

I suppose that a follow up/similar question is how do you change normal action step names in TestStand using CVI functions.

So what is the syntax for something like that?
0 Kudos
Message 1 of 7
(3,011 Views)
Hi,

Have a look at the example in the TestStand\Examples\SequenceBuilderTool\C,
This should help....

Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 2 of 7
(3,011 Views)
Thanks Ray,

but the example that you indicated does not answer my question. I can already create Sequences using CVi, but I would now like to rename the steps (or sub-sequences).

The issue is that if I clone a step twice and insert both those clones into my newly created sequence, they will both have the same name. I would like to be able to rename a step or sub-sequence to any arbitray string.

Marek D.
0 Kudos
Message 3 of 7
(3,011 Views)
Hi Marek,
since you can clone say, the sequence (in the attached .seq I've called it template) then you have it as a property object. Since I've done it all in the same sequencefile, I have to make sure I've renamed it before inserting it back as a new sequence, so I use SetProperty - Name to rename it in memory and then insert it.
You can use the same trick for steps too.
Hope the example makes sense (it does work even though the ring control doesn't necessarily update until you've been to the All Sequences item.)

Sacha
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 4 of 7
(3,011 Views)
Sacha,

Thanks, this is exactly what I'm looking for... sort of. What is the CVI equivalent? I've attached some code with the renaming left out. Could you fill in the blank? (It's not runable code).

Marek
0 Kudos
Message 5 of 7
(3,011 Views)
//templateSeqFile - stores the template sequence file that I'm cloning from
//templateActionSeq - the "Action" sub-sequence within the template file (the sequecence I want to clone)
//newActionSeq - the newly cloned "Action" sequence
//newSeqFile - my new sequence file that I'm creating.

//get "Action" sequence from template file
TS_SeqFileGetSequenceByName(templateSeqFile,NULL,"Action",&templateActionSeq);
//clone the "Action" sequence and store it in newActionSeq
TS_PropertyClone(templateActionSeq,NULL,"",0,&newActionSeq);

//RENAME THE SUB SEQUENCE????
char *newName = "FRED1";

TS_PropertySetProperty(newActionSeq, &errorInfo, TS_PropertyName,
CAVT_CSTRING, newName);

...
CA_FreeMemory(n
ewName);


//insert new action sequence
TS_SeqFileInsertSequence(newSeqFile,NULL,newActionSeq);

Don't forget to release the sequence handles you've gained once you're finished with them. (CA_DiscardObject I think - depends how you defined them.)


I'll leave it to you to work out how you're going to change the name, but since you now know how to do the SequenceFile.SequenceExists check, that shouldn't be a problem.

Hope this helps

Sash.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 6 of 7
(3,011 Views)
Marek,

Sorry about that, I look at that example I quoted and found it had changed in structure, now being all done with the activeX adapter.

Still Sasha has come up with the goods.

Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 7 of 7
(3,011 Views)