NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve comment and version properties form a sequencefile

In our user interface (LW-CVI60) we want to retrieve the comment and version property of a currently loaded sequencefile.
Where can I find a sample code to solve this problem ?
Is it possible without the use of lookup strings ?
0 Kudos
Message 1 of 8
(3,866 Views)
Hi SoftToon,

You will need to use the following to find the Comment

oleErrChkReportErrInfo(TS_SeqFileAsPropertyObject (seqFileH, &errorInfo, &propObjH));

oleErrChkReportErrInfo(TS_PropertyObjectFileGetProperty (propObjH, &errorInfo, TS_PropertyComment,
CAVT_CSTRING, &seqFileComment));

Likewise to obtain the Version use TS_PropertyTypeVersion instead of TS_PropertyComment. This property is also a string.

Depending where you call this functions seqFileH maybe available. If not you can obtain this reference by calling
oleErrChkReportErrInfo(TS_SeqContextGetProperty (seqContextH, &errorInfo, TS_SeqContextSequenceFile, CAVT_OBJHANDLE, &tmpSeqFileH));

Dont forget to free any tmp references.

Hope this helps
Regards
Ray Farmer
0 Kudos
Message 2 of 8
(3,866 Views)
Hi Ray,

I have treid your sample code, but it does not work.
For the comment property I have changed your sample into:
OleErrChk(TS_SeqFileAsPropertyObject (gCurrentSequenceFile, &errorInfo,&CurSeqFilePropObj));
OleErrChk(TS_PropertyObjectFileGetProperty (CurSeqFilePropObj, &errorInfo,TS_PropertyObjectFileData,CAVT_OBJHANDLE, &PropFileObjHandle));
OleErrChk(TS_PropertyGetProperty (PropFileObjHandle, &errorInfo, TS_PropertyComment,CAVT_CSTRING, &getDescription));

This because TS_PropertyComments is not availeble in TS_PropertyObjectFileGetProperty

So for the comment propery, my problem is solved but for the version property I have still a problem because when I change the TS_PropertyComment into TS_PropertyTypeVersion, I get an error "operation
is valid only on types".

Do you have any suggestions ??
0 Kudos
Message 3 of 8
(3,866 Views)
HI,

Sorry about that what I should have put was
oleErrChkReportErrInfo(TS_SeqFileAsPropertyObject (seqFileH, &errorInfo, &propObjH));


oleErrChkReportErrInfo(TS_PropertyGetProperty (propObjH, &errorInfo, TS_PropertyTypeVersion,
CAVT_CSTRING, &typeVersion));
and likewise the for the comment.

Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 4 of 8
(3,866 Views)
Hello Ray

Thank you for the quick respons, but as I mentioned in my last reaction, TS_PropertyComment works fine but, TS_PropertyTypeVersion causes an error with the message "operation is valid only on types".
Thus replacing TS_Propertycomment with TS_PropertyTypeVersion does not work...............

Regards
SoftToon
0 Kudos
Message 5 of 8
(3,866 Views)
Hi,

Yeah I realised that when I spotted my error in my initial response but it should work with TS_PropertyGetProperty instead of TS_PropertyObjectFileGetProperty (which I initially quoted) as TypeVersion is a property of PropertyObject ( see TestStand Programmers Reference manual ).


Hope this clears any misunderstanding.
Ray
Regards
Ray Farmer
0 Kudos
Message 6 of 8
(3,866 Views)
Hello SoftToon -

I believe the KnowledgeBase entry for,How Do I Access a TestStand Sequence File's Comment Subproperty Programmatically?, will assist you with your question about accessing the comments. This tactic leverages a generic API method, so it will work so long as you have some reference to a sequence file that you can treat as a property object. See the attached code for details.

Concerning version strings for a file, in TestStand 2.0.x. there is no method available to quickly expose the version of a file. In this case you will need to use a lookup string. First make sure that you can see TestStand hidden properties (using menus: Configure>>S
tation Options and examine the checkboxes available on the Preferences tab). Now you will have access to the lookup string:

RunState.SequenceFile.Data.Version

You can retrieve this string value any time after loading a sequence file into memory.


Regards-

Elaine R.
National Instruments
http://www.ni.com/support
Message 7 of 8
(3,866 Views)
Hi,

Ok, taking Elaine's comments onboard, this snippet works a treat.

oleErrChkReportErrInfo(TS_SeqFileAsPropertyObject (seqFileH, &errorInfo, &propObjH));


oleErrChkReportErrInfo(TS_PropertyGetValString (propObjH, &errorInfo, "Data.Version",
CAVT_CSTRING, &version));


enjoy.

Ray
Regards
Ray Farmer
0 Kudos
Message 8 of 8
(3,866 Views)