COMPILE FUNCTION obj_Met_Prop(Method,Parms)

/*
	Metrology Properties Methods
	
	Used to get data out of the MET_PROP popup which is where the fundamental
	metrology properties is stored.  It is in a popup because A:  it's very small
	and B: it's almost never changes and C: it's not very easy for a user to get to the data
	and change it.
	
*/

DECLARE SUBROUTINE Set_Status, Msg, obj_Tables
DECLARE FUNCTION Get_Status, Msg, obj_Tables

$INSERT POPUP_EQUATES

EQU COL$PROP_CD		TO 1
EQU COL$PROP_DESC	TO 2
EQU COL$IN_CONV		TO 3
EQU COL$OUT_CONV	TO 4
EQU COL$UNIT_SYMBOL	TO 5
EQU COL$UNIT_DESC	TO 6


ErrTitle = 'Error in stored procedure "obj_Met_Prop"'
ErrorMsg = ''


IF NOT(ASSIGNED(Method))	THEN ErrorMsg = 'Unassigned parameter "Method" passed to subroutine'
IF NOT(ASSIGNED(Parms))		THEN Parms = ''

IF ErrorMsg NE '' THEN
	Set_Status(-1,ErrTitle:@SVM:ErrorMsg)
	RETURN ''
END

Result = ''

BEGIN CASE
	CASE Method = 'GetUnitsSymbol'		; GOSUB GetUnitsSymbol
	CASE Method = 'GetUnitsDesc'		; GOSUB GetUnitsDesc
	CASE Method = 'GetPropDesc'			; GOSUB GetPropDesc
	
	CASE 1

END CASE

IF ErrorMsg NE '' THEN
	Set_Status(-1,ErrTitle:@SVM:ErrorMsg)
	RETURN ''
END

RETURN Result


* * * * * * *
GetUnitsSymbol:
* * * * * * *

PropCd = Parms[1,@RM]

IF PropCd = '' THEN RETURN

Vals = XLATE('SYSREPOSPOPUPS','LSL2**MET_PROPERTY',PDISPLAY$,'X')

LOOP
	Val		= Vals[1,@VM]
	Code	= Vals<1,1,COL$PROP_CD>
	ColVal	= Vals<1,1,COL$UNIT_SYMBOL>
UNTIL Code = PropCd OR Vals = ''
	Vals = DELETE(Vals,1,1,0)
REPEAT	

Result = ColVal

RETURN


* * * * * * *
GetUnitsDesc:
* * * * * * *

PropCd = Parms[1,@RM]

IF PropCd = '' THEN RETURN

	Vals = XLATE('SYSREPOSPOPUPS','LSL2**MET_PROPERTY',PDISPLAY$,'X')
 		
 	LOOP
 		Val		= Vals[1,@VM]
 		Code	= Vals<1,1,COL$PROP_CD>
 		ColVal	= Vals<1,1,COL$UNIT_DESC>
 	UNTIL Code = PropCd OR Vals = ''
 		Vals = DELETE(Vals,1,1,0)
 	REPEAT	
 			
	Result = ColVal

RETURN


* * * * * * *
GetPropDesc:
* * * * * * *

PropCd = Parms[1,@RM]

IF PropCd = '' THEN RETURN

	Vals = XLATE('SYSREPOSPOPUPS','LSL2**MET_PROPERTY',PDISPLAY$,'X')
  		
	LOOP
		Val		= Vals[1,@VM]
		Code	= Vals<1,1,COL$PROP_CD>
		ColVal	= Vals<1,1,COL$PROP_DESC>
	UNTIL Code = PropCd OR Vals = ''
		Vals = DELETE(Vals,1,1,0)
	REPEAT	
  			
	Result = ColVal

RETURN



