01-11-2018 09:40 PM
I'm using Teststand 2016 SP1 and need a way to extract all of the sequence call names of the file during execution. Also, is there a way to extract the sequence call names that are nested inside of a sequence call from the Main Sequence? I'm looking for a way to basically extract the hierarchy of sequence call names, much like what is shown in the hierarchy view window.
01-11-2018 11:41 PM
I just did something similar -- not sure if its the best way but it worked:
Use engine or app mgr to load the sequence file (eg http://digital.ni.com/public.nsf/allkb/125A00298F2A58F186256F9D008268FF)
Get the sequence http://zone.ni.com/reference/en-XX/help/370052N-01/tsapiref/reftopics/sequencefile_getsequencebyname...
For each of the 3 groups, get all steps by getting number (http://zone.ni.com/reference/en-XX/help/370052N-01/tsapiref/reftopics/sequence_getnumsteps_m/) and then getting steps by index (http://zone.ni.com/reference/en-XX/help/370052N-01/tsapiref/reftopics/sequence_getstep_m/)
Use is sequence call property to...see if its a sequence call: http://zone.ni.com/reference/en-XX/help/370052N-01/tsapiref/reftopics/step_issequencecall_p/
If it is a sequence call, get the module: http://zone.ni.com/reference/en-XX/help/370052N-01/tsapiref/reftopics/step_module_p/
Then use variant to data to cast that into a sequence module: http://zone.ni.com/reference/en-XX/help/370052N-01/tsapiref/reftopics/sequencecallmodule/ (you'll have to dig around in the activex menus for this, its in the adapters assembly not the normal TS api)
From that sequence call module reference, you can see there are props for getting the path and the name. I had an issue once I did this where the path was just a short path (ie in the default search paths) so I found some post saying you just need to call this function (http://zone.ni.com/reference/en-XX/help/370052G-01/tsapiref/reftopics/engine_findpath_m/) and that seemed to work.
Since its a tree, you need to either loop or recurse on every sequence call to generate a hierarchy.