Page 1 of 1

How to get number of samples from sequence with macro ?

Posted: Mon Oct 01, 2018 2:39 pm
by Or4ng3Tree
Hi!

I make a monitoring program to MSD Chamstation and Chamstation and i need to numbers of samples from the sequence table with macro when post-seq is run, but i dont know how get it and i dont find in documentations.
Can you help to me ?

Re: How to get number of samples from sequence with macro ?

Posted: Thu Oct 11, 2018 8:52 pm
by Trishia
For Chemstation (newer versions), you can find the value in the _SEQUENCE register. So for example:

numOfSamples = TabHdrVal(_SEQUENCE[1], "SeqTable1", "NumberOfRows")

As for MSD Chemstation (assuming an older version?), it's a little trickier since there doesn't seem to be a variable directly associated with the currently loaded sequence. One trick would be to directly access the SAMPLELOGTABLE data. In fact, there is a macro you can find and modified (called something like GetNumLines). Technically, you could do something like the following (pulled from mentioned macro; you can view the documentation or the macro itself for more details)

SAMPLELOGTABLE POSITION, "-1" !last line in seq. becomes pending line
SAMPLELOGTABLE ADVANCE !move by one
SAMPLELOGTABLE GETENTRY !get values for current entry
VARLOCK OFF
If (_runtype = -1) Then
_NUMLINES = _SEQLINE - 1
Else
_NUMLINES = _SEQLINE
EndIf
If (_SEQLINE = 349) Then !has to do with maxlines
SAMPLELOGTABLE ADVANCE
SAMPLELOGTABLE GETENTRY
If (_runtype <> -1) Then
_NUMLINES = _NUMLINES + 1
EndIf
EndIf
SAMPLELOGTABLE POSITION, "1"
VARLOCK ON

You may need to modify depending at what point you want to get this data (for example if it's resuming or something like that).