LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Get TS Step Name String from CVI

I would like to get the step name, in CVI, of the currently executing TS step. Using CVI 6.0 and TestStand 2.0.

partial code:

char *stepName;

error = TS_PropertyGetValString (testData->seqContextCVI, &errorInfo,"RunState.Step.Name", 0,&stepName );

An error is returned and the stepName is returned as "Un-initialized"

How do I get the StepName string?
0 Kudos
Message 1 of 6
(3,818 Views)

Hi joebae,

In TS 3.5 I have the RunState.NumStepsExecuted property. While executing the first step its value is 0, for the second step it is 1, etc. So you can use it directly as a step index (since index is zero-based). And it resets at the beginning of Setup, Main and Cleanup. To distinguish if TS is currently in Setup, Main or Cleanup you can use RunState.StepGroup. So you can use StepGroup together with NumStepsExecuted to get which step in which group is executing.

But, for the step name I could not find a direct solution either. Maybe you can locally in CVI store an array of step names. I know, it becomes a pain when you change a step name or order but that is the best I could find for now.

I will inform you if I can find a better solution.

S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 6
(3,804 Views)

Hi again joebae,

There is not a Name property in TS sequence context, but in TS help I saw Step.Name. Maybe you can access it through CVI directly.
So you can probably write the following as the lookup string:

RunState.Sequence.Setup/Main/Cleanup[RunState.NumStepsExecuted].Name

Hope this helps.

S. Eren BALCI
IMESTEK
0 Kudos
Message 3 of 6
(3,801 Views)
joebae,

The way you would want to access this is through the TestStand API ActiveX calls. You will need to get a reference to the current running step as described indexing from RunState.NumStepsExecuted, you will then need to use an API method to grab the name, I'm looking to see what the API call is for TestStand 2.0 and will post back here as soon as I find it.

Message Edited by Brandon V on 04-19-2007 01:52 PM


Brandon Vasquez | Software Engineer | Integration Services | National Instruments
0 Kudos
Message 4 of 6
(3,777 Views)
The API Method you are going to need to call is PropertyGetProperty with the PropertyID as Name in the PropertyObject class of the TestStand API.

Brandon Vasquez | Software Engineer | Integration Services | National Instruments
0 Kudos
Message 5 of 6
(3,765 Views)
Thanks for the assistance
 I was able to find the solution in the Simple.c example from CVI 6.0
 In TS 2.0 CVI 6.0 more info is needed from the Seq to get the step name
// Declare variables
    CAObjHandle step = 0;
    CAObjHandle sequence = 0;
    int error = 0;
    long        StepIndex = 0;
    long        phaseIndex = 0;
    char *      stepName = 0;

     // Get The Step index into the program
    error = TS_SeqContextGetProperty (testData->seqContextCVI, &errorInfo,
                                        TS_SeqContextStepIndex, CAVT_LONG,
                                      &StepIndex);

    //Get the Seq Context SetUp, Main or Cleanup 
    error = TS_SeqContextGetProperty (testData->seqContextCVI,
                    &errorInfo, TS_SeqContextStepGroup,
                                    CAVT_LONG, &phaseIndex);

    // Get the OBJ handle to the Sequence
    error = TS_SeqContextGetProperty (testData->seqContextCVI, &errorInfo,
                    TS_SeqContextSequence,
                                   CAVT_OBJHANDLE, &sequence);
   
    // Get the Step Number
    error = TS_SequenceGetStep (sequence, &errorInfo, StepIndex,
                                       phaseIndex, &step);

    // Get Step name to of the Step
    error = TS_StepGetProperty (step, &errorInfo, TS_StepName,
                CAVT_CSTRING, &stepName);

*******************************************************************************
 In TestStand 3.0 CVI *.0 it is very simple to get the Step and Step name

// Declare variables
    CAObjHandle step = 0;
    char* stepName = 0;

// Get the step number as an Obj handle
    TS_SeqContextGetStep(testData->seqContextCVI, &errorInfo,&step);
// Get the name of the step from the Obj handle
    TS_StepGetName(step, &errorInfo, &stepName);


0 Kudos
Message 6 of 6
(3,739 Views)