08-15-2011 11:42 AM
I'm trying to figure out the best way to store the sequence file Revision in the database. That is, if I have the Revision (SequenceFile.AsPropertyObjectFile.Version), where (e.g. what table / field) should I put it if I'm using the SQL Server schema that ships with TestStand? How do I get it there?
Solved! Go to Solution.
08-15-2011 12:00 PM
If you just place down an Action step type using the "None" adapter and then add an additional result with the Version property you specified then it will automagically get put in the default database.
The actual value goes into the PROP_RESULT table. The NAME field in that same table is the Name field in the additional results table for the step.
You could also use the Additional Result step type to do this as well.
Hope this helps!
08-15-2011 12:17 PM
That does help 😄 Is there a way to do that from the process model so we (9 developers) don't have to manually add it with each new client sequence?
08-15-2011 03:32 PM
You can create a custom step type and share that amongst your team or the simper way to create a step template and share that. Custom step type is probably overkill for something this simple.
08-15-2011 03:37 PM
Thanks for the idea. We would like to do this programmatically if at all possible. This way, we don't have to add it to some sort of checklist. Since the application is for government, it is not trivial to change the implementation later.
Any ideas for programmatically inspecting the client sequence revision and storing it to the database from the process model?
08-15-2011 03:49 PM
In very beginning of your process model you have access to the full path of the client sequence file by accessing RunState.ProcessModelClient.Path
You should then be able to add a step towards the beginning of your process model that accesses the client sequence file and stores the Revision to the DB.
08-15-2011 04:27 PM
LabBEAN,
In general it is a bad idea to have the process model log or report. The only cases being the header info. So if you want it to be a process model function then you will have to do it like the other header info which gets logged to the UUT_RESULT table. Such as the station id, user login name, execution time, etc.... This will be tricky to do however because you will have to figure out how they do those and then add specifically for the version like you want. It is probably better to put it in the STEP_SEQCALL table because that table has the path to the sequence file.
From the process model you want to use RunState.ProcessModelClient.AsPropertyObjectFile.Version.
Here's a nifty little document on Database Schemas: http://zone.ni.com/devzone/cda/tut/p/id/6484
BTW- if you just place a step in your process model hoping it will automagically log then you are mistaken. It will log to the database but your report will be all screwed up. I don't recommend this at all.
If you are like me and don't want the headache of managing a new schema/database then your best option is just to create a step that does what you want and then save it as a template. Then force all your developers to just add it to all their sequences at the beginning somewhere. Maybe a temporary fix until you can go change the schema and get that working?
Lemme know if you have any other questions,
08-15-2011 05:39 PM
Ok LabBEAN,
Here is my tutorial. It is actually easier than I thought:
Step 1: Configure>>Database Options and uncheck the Disable Database Logging.
Step 2: Click the Data Link tab
Step 3: Make sure the Connection String Expression is pointing to the right location. Should be a public directory with a .mdb file if you are using TestStand defaults. Click the View Data button to verify. It should open the Database Viewer so you can look at the tables. Leave the Database Viewer open.
Step 4: Click the Schemas tab
Step 5: With the Generic Recordset (NI) selected click the Duplicate button.
Step 6: You should now see a copy of that schema. In the Name box name it MyRecordset and make sure it is checked
Step 7: Click the Statements tab and highlight STEP_SEQCALL. NOTE: you must always do this before clicking on the Columns/Parameters tab
Step 8: Click the Columns/Parameters tab
Step 9: Highlight the SEQUENCE_FILE_PATH item and click the Copy Button
Step 10: Highlight the new entry and change the Name to SEQUENCE_FILE_VERSION
Step 11: MOST CRITICAL STEP: Change the Expression to RunState.Engine.GetSequenceFileEx(Logging.StepResult.TS.SequenceCall.SequenceFile, 107, ConflictHandler_Error).AsPropertyObjectFile.Version It is better to do it this way because you never now where a sequence file call will be made and not all sequence calls are made to the model client sequence.
Step 12: Hopefully you left the Database Viewer open from Step 3. Go to it.
Step 13: Right click the STEP_SEQCALL and select Add Column.. Name the new column: SEQUENCE_FILE_VERSION. Basically you need a column that matches the one you created back in the Columns/Parameters tab. Set it up with the same type and size. NOTE: there is an alternate way to do this using the Execute SQL View in the Database Options but you need to create it. You can create it from the Schemas tab back in TS by clicking the Build .sql File.. button.
Step 14: Back in TestStand click OK to save and close the Database Options.
Now run your sequence and you will see the new data in your database.
08-15-2011 05:47 PM
BTW- Those changes get stored in the TestStandDatabaseOptions.ini file if you want others to use them.
08-16-2011 09:25 AM
jigg- Thanks for the *detailed* instructions. Looks like that could take care of the database portion.
When we enter a new column (and expression), does TestStand also add that information to the report? If not, is there a method that works in concert with what you've suggested? That is, in light of the schema modification, how would you add the version to the UUT report? I'd prefer not to modify the default XML style sheet if possible.