Home : VSAMP
Q10842 - INFO: VSAMP

FUNCTION returns the Lab Cal sample information for a variable/DateTime.

SYNTAX:

VSAMP(VarNum,Offset/Date, Field, Optional NoValuePrint, Optional Interval, Optional IntervalNum, )

VarNum:  The variable number to get results for.

Offset/Date: If the field is numeric it is assumed to be the offset and is defined as the offset from the start date of the report.  For example, if the start date is 1/1/2000 and the offset is 1, the value from 1/1/2000 will be returned.  If the offset is 2, the value from 1/2/2000 will be returned and so forth.  If the field is a date in quotes or a cell reference to a cell containing a date the value for the date will be returned.

Field: The field in the Sample (tables LC_SAMPLE, LC_SAMPLETEST) to return.  Common fields:
  ID
  SAMPLENUM
  SAMPLENAME
  ANALYZEDBY
  ANALYZED_DATETIME,ANALYSIS_END
  ANALYSIS_START
  SAMPLEDBY
  SAMPLEDBY(ID) - Id field to LC_PEOPLE table
  ASSIGNEDTO
  LOCATION
  LAB
  LABID
  SAMPLEVOLUME
  VOLANALYZED
  SAMPLETYPE
  DATECOLLECTIONDUE
  SAMPLEDTTIME
  RECEIVED_DATETIME - Received in Lab date/time.
  RECEIVEDBY
  SAMPLESTATUS
  SAMPLESTATUSDESC (i.e. Pending, Received, Analyzed, Closed...)

SAMPLESTATUS SAMPLESTATUSDESC
0 Pending
4 Received 
5 Analyzed
8 Skipped 
9 Closed

  NOTES
  PARENTID (ID field to LC_SAMPLE table to lookup Parent Sample)
  SAMPLEUD1-SAMPLEUD5 (Sample user defined fields)
  METHOD.NAME
  METHOD.DESC
  METHOD.GROUP
  METHOD.ACRONYM
  METHOD.TYPE
  TEST.NAME
  TEST.HOLDTIME
  TEST.COST
  TEST.MDL
  TEST.RL
  TEST.CASNO
  TEST.TESTACRONYM
  TEST.TESTBASIS
  TEST.LABSECTION

NoValuePrint:  Text or value to print if no value exists. 

Interval:  Used to retrieve data outside the report date range.  The interval sets whether to go back years (yyyy), months (m), etc…  The following are the valid settings for Interval

yyyy    Year
q         Quarter
m        Month
y         Day of year
D        Day
w        WeekDay
ww      Week

IntervalNum:  Used to retrieve data outside the report date range.  The interval number set the number of Intervals to go back. 

NOTES:

You can use the ID fields (PARENTID,  SAMPLEBY) with SQLFIRST function to lookup display values for these ID fields.

EXAMPLES:

(Start Date of report is 1/1/2000)

VSAMP(1,1,"SAMPLENUM")  Return the Sample Number for the sample associated with Variable #1 on 1/1/2000.

VSAMP(7,2,"SAMPLEDTTIME") Return the Sample Date/time for the sample associated with Variable #7 on 1/2/2000....

VSAMP(1021,1,"SAMPLENUM","No Sample Schd") Returns the Sample Number for the Lab Cal Sample associated with variable 1021 on the 1st day of the report (1/1/2000).  Prints No Sample Schd if no sample for the date exists.

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.
Created on 3/24/2008 12:03 PM.
Last Modified on 10/19/2018 4:19 PM.
Last Modified by Scott Dorner.
Article has been viewed 2220 times.
Rated 0 out of 10 based on 0 votes.
Print Article
Email Article