C# interop get Step Name

I am attempting to use a C# code module in order to read the calling step's name. However, my code only every returns "Step" as the name of the object (regardless of what the step is actually called in the sequence). Note that I have also tried doing the same thing to get the calling sequence name - and it always returns "Sequence". Where am I going wrong? Here is the code: (please see attachment for complete source and example TestStand sequence in the "Debug" folder.
using System;
using System.Collections.Generic;
using System.Text;
using NationalInstruments.TestStand.Interop.API;
using System.Windows.Forms;
namespace Test
    public class TestClass
        public void TestMethod(SequenceContext thisContext)
            PropertyObject pObj = thisContext.AsPropertyObject();
            PropertyObject stepObj;
            stepObj = pObj.Evaluate( "Step" );
            MessageBox.Show(stepObj.Name);
As a bit of background, I am trying to retrieve the name of the calling step and the name of all Sequence calls all the way up the stack to the root. This same methodology works using Expression steps, but I want to hide all the mess into a single code module. Any ideas would be appreciated! 
Thanks,
Phil
Solved!
Go to Solution.
Attachments:
Test.zip ‏16 KB

Hi Ray,
Thanks for the advice. Unfortunately, I think I made my example a little too simplistic! Your solution is perfect for the Step Name case, unfortunately it will not work for what I am trying to do. I am writing a custom result logger that is called from the ProcessModelPostResultListEntry callback, and want to check whether the "RecordResult" option is enabled on all of the SequenceCall steps in the stack and whether each Sequence in the stack has the "RecordResults" option enabled. (Basically, Result Recording must be enabled at all levels for the result to be logged). You may think that the ProcessModelPostResultListEntry callback would only get called if this condition is met - unfortunately it is only affected by the most nested combination of the Step's "RecordResult" and the Sequence's "RecordResults" properties. Therefore, frustratingly, I need to check all the way up the stack back to the ProcessModel. The reson why this is more complex is that the Step and Sequence property objects further up the stack can only be accessed by using the Evaluate() Method, as opposed to the lowest level in the stack which can be accessed via thisContext.Step and thisContext.Sequence.
Anyway, I worked it out in the end: Expressions within TestStand enable you to take a number of API shortcuts which are not available when using the API in another language - hence why I was able to use expressions like:
Locals.SequenceRef = Evaluate( "RunState.Caller.RunState.Caller.Sequence" ),
Locals.SequenceName = SequenceRef.Name
Locals.SequenceRecResult = SequenceRef.RecordResults
whereas similar code in C# did not work as expected (note that the RunState.Caller string above is actually built dynamically depending on the call stack depth).
Being more explicit in C# does work correctly though:
seqObj = pObj.Evaluate( "RunState.Caller.RunState.Caller.Sequence" );
SequenceName = seqObj.Evaluate( "Name" ).GetValString("", 0 );
SequenceReqResults = seqObj.Evaluate( "RecordResults" ).GetValBoolean( "", 0 );
Although, in the process of writing this response, I have just found the following property:
SequenceContext.CallerDiscardsResults
"Returns whether any sequence in the call stack instructs TestStand to disable results or if any calling step up the call stack instructs TestStand to not record results"
Typical! I think this may be an easier route to use!!!
Thanks anyway,
Phil
Message Edited by monkeyslikebananas on 03-11-2009 01:40 AM
Message Edited by monkeyslikebananas on 03-11-2009 01:41 AM

Similar Messages

  • Get step name of currently executing step from post expression tab

    Hi,
    I am trying to create a custom step type that records the step name and step results in an array. I have been having trouble trying to access the Step Name property from the post-expressions tab.
    One option is to use locals.resultslist[], however, that is only populated once the step executes and hence i cannot access its name through post-expressions. Is there any other property that contains the step name, that may be populated correctly before the post expression  is executed?

    I just realized, this has been posted under LabView. Please disregard this, I am putting it under Test Stand.

  • How to Get the step name of MainSequence from SequenceFilePreStep / SequenceFilePostStep?

    I'm using SequenceFilePreStep & SequenceFilePostStep to get the test time of every step. Is there any way to get the step name of MainSequence that calls the PreStep & PostStep callbacks? Thanks

    Hi,
    You can get the name of the sequence by NameOf(RunState.Caller.RunState.Sequence).
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • How to get all step names within a group or a sequence?

    Hi,
    I'd like to show all the names of the steps within a sequence or a group.
    I wonder if there is a simple function which can be used directly, such as RunState.PreviousStep.Name.
    I tried via a foolish way to append each step name, though it shows all the step names but I still think there is a simple function can access all the step names.
    Can anyone give me some suggestion, thanks a lot!!!
    Solved!
    Go to Solution.
    Attachments:
    ShowAllStepName.seq ‏8 KB

    I've doctored up your sequence a little.  But yes you have to loop.
    Also, what format do you want the names in?
    Hope this helps,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~
    Attachments:
    ShowAllStepName.seq ‏8 KB

  • Changing Step Name in XML Report programmaticaly

    I am trying to change the step name programmaticaly in TestStand to reflect in the XML report. The step is executed several times in a loop, and every time the loop runs I want the step to be named differently in the XML report. For example, the names will be something like this < Test1: Signal Name 1>, <Test2: Signal Name 2> ....etc. Any help on this will be appreciated .
    Thanks,
    Sam

    Hi,
    The best time to change the name is before you perform the test, then it will get inserted in the ResultList and hence into your report.
    I have attached one way of doing this. You can also perform it after the Step you wish to change, in which case you would use the RunState.PreviousStep as a reference.
    You could call the API method as part of your code.
    Remeber, if you use a PropertyLoader to load Limits, and you have placed this inside the loop, then your Limits file for the Step Name must match the new step name not the old one that you see statically.
    This is a TS3.5 example.
    Hope this helps
    Regards
    Ray Farmer
    Regards
    Ray Farmer
    Attachments:
    Sequence File1.seq ‏25 KB

  • How to get file name of the form attachment?

    Hi,
    is there anybody who is able to help me with the following problem???
    I started my process from Workspace ES and as a first step I attached one locale file (IMG.JPG or IMG.TIF e.g.) as a form attachment. I used "Attachments" bookmark in the Workspace ES.
    I need to get file name of attached file in the process!!!
    I tried to use "getTaskAttachments" component to get file name of form attachment but without success. This component successfully obtained attached file an stored it in the variable (type list, subtype document) but didn't produce all file attribute informations such as basename or Content Type:
    Is there some possibility to obtain file name (including file extension) by using "standard" tools and components of ALC?
    Thanks for your suggestions.

    Hi LekomDev,
    I faced the same situation some time back and this is what I know.
    Based on the file type few of the attributes will or will not be populated. (This is what the official documentation says about Document attributes)
    The file name that you are looking for would mostly be in 'name' attribute of Document object. The 'wsfilename' attribute is the atrribute which gets used to show the file name into Attachments tab of the workspace.
    So, if you are just interested in knowing the filenames then 'name' attribute is the place that you are looking for.
    But if you are trying to solve an issue in which Attachments against a Task isn't showing the filenames properly then you would need to copy the 'name' attribute value into 'wsfilename' attribute and then the Attachmetns against a Task would have the correct names.
    Tip: Use the Record and Playback option of the workbench to inspect the Document variable and you would see all of the values for a Document variable at desired step in your orchestration.
    hope this helps,
    cheers,
    Parth Pandya
    Blog: http://livecyclekarma.wordpress.com

  • How can I get the name of an Array Item in LabVIEW

    Hi,
    I would need to display the name of the items in the Step.Result.Measurement array in a VI. I can access these properties using the index, but I don't know how to get the name of them like Step.Result.Measurement[0] .
    Is there any suggestions to do it in an elegant way?
    Andras

    Hi Andras,
    look here.
    Regards, Guenter

  • How to get the name of a previous test?

    Hi,
    The top level of my sequence is a list of subsequences, each one being a  sub-test.
    While inside one particular sub-test I would like to know the name of the sub-test which was executed before the one I'm in at the moment.   Obviously this is relevant only when I run selected sub-tests.
    example:
            MyTest.seq
                 sub-test1
                 sub-test2
                 sub-test3
    I'm inside sub-test3 (in the setup or main sequence), and would like to know the name of the sub-test which was executed before sub-test3.  It is possible that no sub-test ran before sub-test3.
    Thanks
    RK
    Solved!
    Go to Solution.

    Hi Rafi,
    Just in case you are using an earlier version of TestStand than 4.0, you might consider using the NameOf() function since you wouldn't be able to directly access the TestStand API through expressions.  Here are a couple articles to look into.
    Getting the Name of Any TestStand Property Programmatically in TestStand
    Storing Step Names of a Sequence in a Local Variable
    Let me know whether the suggestions above point you to a solution. 
    Rod T.

  • Get File name using File Adapter

    Does anyone know how to get the file name that has been picked up so it can be past to a variable so it can be used in the BPEL process.
    cheers
    James

    Hi James,
    Here the STEPS,
    Create File Adapter.
    Add File Adapter Service to Receive Activity.
    Click Receive Activity and goto Adapters Tab.
    Click "Tourch" to get variable names.
    Select Variable -> Process -> Variables and Click on "Create New Variable" icon and give name.
    Select "Message Type" and click "Tourch" icon.
    Now you select "Partner Links" -> FileAdapter WSDL -> Imported WSDL -> Message Type -> InboundHeader_msg and select OK.
    It's done.
    now you can use this Global Variable to get Filename and Directory name.
    Regards,
    Bhavesh Thaker.

  • Missing chain step name in events raised by the scheduler

    I use events raised by the scheduler (SYS.SCHEDULER$_EVENT_QUEUE) to monitor scheduler chains processing.
    For event_type = "JOB_STARTED" (chain step started in case of chains) in event message (sys.scheduler$_event_info) there is no log_id (log_id is null).
    In user_scheduler_job_log view there is column job_subname that contains chain step name but this column is missing in the event message.
    Is there any way to get chain step name for event_type = "JOB_STARTED"?
    Job configuration:
    dbms_scheduler.set_attribute(
    name => job_name,
    attribute => 'logging_level',
    value => dbms_scheduler.logging_full
    dbms_scheduler.set_attribute(
    name => job_name,
    attribute => 'raise_events',
    value => dbms_scheduler.job_all_events
    Database:
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    OS:
    CentOS - redhat-4
    Regards
    Mariusz

    I want to track chain processing by dequeue messages from SCHEDULER$_EVENT_QUEUE.
    Examples of messages automatically inserted by scheduler into SCHEDULER$_EVENT_QUEUE (user_data column from SCHEDULER$_EVENT_QTAB)
    SYS.SCHEDULER$_EVENT_INFO('JOB_SUCCEEDED','CDWMAIN','JOB_NAME','2011-07-27 16:19:11.191969',0,NULL,0,340374,1,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)
    SYS.SCHEDULER$_EVENT_INFO('JOB_STARTED','CDWMAIN','JOB_NAME','2011-07-27 16:19:10.947994',0,NULL,1,NULL,0,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)
    SYS.SCHEDULER$_EVENT_INFO('JOB_CHAIN_STALLED','CDWMAIN','JOB_NAME','2011-07-27 15:45:13.727127',0,NULL,0,NULL,0,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)
    For event JOB_SUCCEEDED there is log_id = 340374 so we can find job_subname (chain step name) in log table.
    For JOB_STARTED and JOB_CHAIN_STALLED there is no log_id so we do not know wich chain step in this case was started and wich chain was stalled.
    JOB_NAME is the same for all steps in case of chain processing

  • MSG.EXE Error 1722 getting session names?

    I have a vista and whenever I send msg to someone else on my "workgroup" it says "Error 1722 Getting session names. I tried msg /?. It sends a message to myself though... ("msg /server:COMPUTERNAME USERNAME "MESSAGE")

    Hi,
    Please try the following steps:
    Before modify the registry keys, please take a backup of the key. For more information about how to back up and restore the registry, please click the
    following link to view the article:
    Back up the registry
    Please add the following registry entry with logon script:
    HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server
    Name : AllowRemoteRPC
    Type : REG_DWORD
    Value : 1
    References:
    Net Send in Windows Vista
    How to configure RPC dynamic port allocation to work with firewalls
    Regards,
    Sabrina
    This posting is provided "AS IS" with no warranties or guarantees, and confers no rights. |Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
    This can be beneficial to other community members reading the thread.

  • !!! Digital Signature - get Signer name

    Hi all,
    I need to get the name of signer in DS process!
    I used the function ds_log_display and with a debugger i saw the name in one of the structure of another function bal_log_msg_read (called from above func.) .
    When i tried to use bal_log_msg_read  in my prog i get no messages because a <b>macro</b> in this function get the data as first step...
    I checked also:
    SAP_BAL_DEMO_05 - unsuccessfully
    BAL_DSP_LOG_DISPLAY -  unsuccessfully
    Bal_db_search - successfully
    balm, balhdr tables
    May be there is another solution to get the name of the signer.
    Please your help. i need a solution as soon as possible.
    Thanks in advance,
    Ronit

    hi
    please check if the folowing helps...
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0fbaa71-cd8d-2910-5982-e30626035400
    http://abapcode.blogspot.com/2007/06/adobe-document-service-digital.html
    regards
    dinesh

  • How to Get Package Name While Running

    Hi
    i want to load Package Name to Table.
    So any idea about ODI Ref Function to get Package Name.

    Hi Nagarjuna,
    You can get package name by doing following steps, as per my knowledge, scenario name and package name both are same in ODI (while creating scenario for package).
    by the time you can retrieve scenario name as package name using below select query with selecting Work Repository schema in ODI variable
    QUERY:
    select SESS_NAME
    from <%=snpRef.getObjectName("L","SNP_SESSION","D")%>
    where SESS_NO = <%=snpRef.getSession("SESS_NO")%>
    Steps:
    1) create a project variable as Get_Package_Name and Data type as Alphanumeric, in Refreshing tab, type above select query and select work repository schema in schema (eg: create WorkRep logical schema in topology manager)
    2) Add Get_Package_Name variable with refresh in package (before interface step)
    3) Generate Scenario for package with same package name with version 001
    When you execute the scenario you can retrieve the package name in Get_Package_Name odi variaable
    Hope this may helps you
    Regards,
    phanikanth

  • Know steps names of called sequence file using sequence call step type in TestStand

    Hi,
        I have a problem in accessing step names in called sequence file using "Sequence call"step type in TestStand 4.0.
    I would list out all step names of called sequence file. Is it possible to do through C#.NET? If, yes, Please explain to me in detail with possible example.
    Thank you,
    regards
    RKK

    Hey RKK,
    I want to first set your expectations for the forums.  This is not a place for people to review and rewrite your code for you; this is a place for specific and general questions.  I am not saying your question in this thread is inappropriate, because it is a good questions.  We should just not post code and ask others to fix it here.  If you are looking for this type of service we have alliance members that can help you write your TestStand Operator Interface (www.ni.com/alliance).
    As for you question about getting the sequence names for a sequence file that is not the currently running sequence file, you will need to open a reference to that sequence files and then use the API calls that I mentioned in my previous posts.  You can use the Enigine.GetSequenceFileEx function to open a reference to sequence file, and you will need to close the reference with the Engine.ReleaseSequenceFile function when you are done using it.  After you have a reference to this external Sequence File, you can use the example dll and sequence I previously sent you.  I also attach a new sequence file (SeqFile2.seq) plus an updated GetNames.seq to illustrate how to use the above mentioned functions.  I hope this helps.  Have a great day!
    Best Regards,
    Software Engineer
    Jett R
    Attachments:
    GetNamesOfSequencesInFile.zip ‏52 KB

  • Finding Step Name from ProcessModelPostStep Callback

    I am trying to get the 'Step Name' of the current step in the client sequence file from inside the ProcessModelPostStep Callback.
    Does anybody know the property lookup string?
    Regards
    Steve
    There are 10 types of people in the world that understand binary, those that do and those that don't.

    Same trick, different lookup will also work :
    NameOf(Parameters.Step)
    Thanks
    Sacha Emery
    National Instruments (UK)
    // it takes almost no time to rate an answer

Maybe you are looking for

  • Message: "your computer was restarted because of a problem..."

    Hi all, Just upgraded to OS X Mavericks as soon as it became available for me to download. However, a few times now, while I'm doing things, my Mac Mini keeps freezing up for a second and then restarts itself, showing a screen that says, "your comput

  • HT4528 how do I delete all my photos from my phone

    How do I delete all my photos from my phone using my phone?

  • Unable to go to change mode of variable in BI query designer

    Hi Friends, I need to change the variable in BI Dev server to meet the requrement, but when ever i am trying go to change mode of variable (right click on the variable and click on restriction) getting the error that <i>"the key is already is assosia

  • Preview application color management

    Print with preview from a psd document letting PS determine colors to Epson R2400, preview shows washed out or wrong colors. Is Tiger's preview app useless once you let PS determine color? G5 2.3 2.5RAM/PowerBkG41.67 1.5RAM   Mac OS X (10.4.8)   Aper

  • Read unicode file using java

    Hi all, I'm fairly new to java. In my program i need to read a Unicode file. (When i did it normal way it shows only "?" s for all the non English characters). can any one help me? (It better u can sent a simple example too) Thanks. regards, wijitha