NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Add Label (and other things like SequenceCall, Statement etc) in Main Sequence ?

Solved!
Go to solution

Hi all,

I try to add Label in Main sequence, but problem is how to refer there. Successfully were done subsequences and their content, but now want to add content in main sequence (labels, SequenceCall, Statement etc). Can you someone help me with this code ? (CVI/LabWidows). This code in intended to add Label (szName) into Main sequence.

Before entering Label, need to refered to Main in Sequence file. This part missing.

tsErrChkMsgPopup( TS_EngineGetSeqFileEx (EngineHandle, &errorInfo, SeqTemplate_path,  TS_GetSeqFile_DoNotRunLoadCallback, TS_ConflictHandler_Prompt, &SequenceFileHandle));
          tsErrChkMsgPopup( TS_EngineNewStep (EngineHandle, &errorInfo, "","Label",&labelStep));
							tsErrChkMsgPopup( TS_StepSetName (labelStep, &errorInfo, szName));	
							error = TS_SequenceInsertStep (SequenceFileHandle, &errorInfo, labelStep, indexL, TS_StepGroup_Main);

 I've tryed with TS_SeqContextGetMain(), but does not work.

 

Best regards,

branar

0 Kudos
Message 1 of 6
(2,981 Views)

The part you are missing is the Sequence.

 

You have a handle to a SequenceFile, now you need is a Sequence either by add a new sequence using Engine.NewSequence then doing an Insert. Or using SequenceFile.GetSequence. Seeing you have the SequenceFile you want to use the GetSequence method.

 

 

Regards
Ray Farmer
0 Kudos
Message 2 of 6
(2,979 Views)

Hi Ray,

Still does not work. I've tried first to add Sequence, but it was add subsequence (not is MainSequence)

		tsErrChkMsgPopup( TS_EngineGetSeqFileEx (EngineHandle, &errorInfo, SeqTemplate_path,
					  TS_GetSeqFile_DoNotRunLoadCallback, TS_ConflictHandler_Prompt, &SequenceFileHandle));
						//	tsErrChkMsgPopup( TS_EngineNewSequence (EngineHandle, &errorInfo, &newSequence));
			            //    tsErrChkMsgPopup(TS_SequenceSetName (newSequence, NULL, "Main"));
			            //    tsErrChkMsgPopup( TS_SeqFileInsertSequence (SequenceFileHandle, &errorInfo, newSequence));
						
										tsErrChkMsgPopup( TS_EngineNewStep (EngineHandle, &errorInfo, "","Label",&labelStep));
							tsErrChkMsgPopup( TS_StepSetName (labelStep, &errorInfo, szName));	
							error = TS_SequenceInsertStep (SequenceFileHandle, &errorInfo, labelStep, indexL, TS_StepGroup_Main);

 After that, I was tried with:

		tsErrChkMsgPopup( TS_EngineGetSeqFileEx (EngineHandle, &errorInfo, SeqTemplate_path,
					  TS_GetSeqFile_DoNotRunLoadCallback, TS_ConflictHandler_Prompt, &SequenceFileHandle));
								tsErrChkMsgPopup( TS_SeqFileGetSequence (SequenceFileHandle, &errorInfo, 0, &Sequence));
							tsErrChkMsgPopup( TS_EngineNewStep (EngineHandle, &errorInfo, "","Label",&labelStep));
							tsErrChkMsgPopup( TS_StepSetName (labelStep, &errorInfo, szName));	
							error = TS_SequenceInsertStep (SequenceFileHandle, &errorInfo, labelStep, indexL, TS_StepGroup_Main);

 Problem is probably in defining seq. file's MainSequence. So, I use two files (one default where i get normal subsequencies, and second (target), created with new formed subsequencies and default file. New subsequencies are copied into a target file. Adding context in MainSequence seems to be problematically, at least for me. I want first to "fulfill" mainSequence (trying to get code for this) and after that rest of subsequences and default context. My code currently create subsequences and their context succesfully.

 

best regards,

branara

0 Kudos
Message 3 of 6
(2,977 Views)

If you create a new sequencefile, it will already have a MainSequence by default and it will be the first element in an array of Sequences so you dont have to Insert a sequence called "MainSequence".

Regards
Ray Farmer
0 Kudos
Message 4 of 6
(2,971 Views)

Also,

 

when you insert the step into the sequence you appear to be using the SequenceFile reference rather than the Sequence reference.

You insert steps into a sequence not a sequence file.

 

 

Regards
Ray Farmer
0 Kudos
Message 5 of 6
(2,968 Views)
Solution
Accepted by topic author branar

Hi Ray,

reason why is used SecuenceFileHandle was that I modify existing file (not creating new one). Simply, add subsequences to default file and save as different name. Problem is now solved by

TS_SeqFileGetSequenceByName (SequenceFileHandle, NULL, "MainSequence", &SequenceHandle)

 I search for "MainSequence" and adding stuffs there. Previously, MainSequence was created and two sequence with same name were existi.

 

best regards,

branara

0 Kudos
Message 6 of 6
(2,956 Views)