added LSL2 stored procedures
This commit is contained in:
198
LSL2/STPROC/OBJ_POPUP.txt
Normal file
198
LSL2/STPROC/OBJ_POPUP.txt
Normal file
@ -0,0 +1,198 @@
|
||||
COMPILE FUNCTION obj_Popup(Method,Parms)
|
||||
/*
|
||||
Methods for the Popup table
|
||||
|
||||
06/12/2004 JCH - Initial Coding
|
||||
|
||||
Properties:
|
||||
|
||||
Methods:
|
||||
|
||||
CodeDesc(PopupID,Code) ;* Returns column 2 data for code in column 1
|
||||
|
||||
*/
|
||||
|
||||
|
||||
DECLARE FUNCTION Get_Status, Msg, Utility, obj_Tables
|
||||
DECLARE SUBROUTINE Set_Status, Msg, obj_Tables
|
||||
|
||||
$INSERT MSG_EQUATES
|
||||
$INSERT POPUP_EQUATES
|
||||
|
||||
ErrTitle = 'Error in Stored Procedure "obj_Popup"'
|
||||
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 = 'CodeDesc' ; GOSUB CodeDesc
|
||||
CASE Method = 'DescCode' ; GOSUB DescCode
|
||||
CASE Method = 'CodePosition' ; GOSUB CodePosition ;* Pass in code(s), returns line position(s) as stored in the Popup
|
||||
CASE Method = 'AllCodes' ; GOSUB AllCodes
|
||||
CASE 1
|
||||
|
||||
END CASE
|
||||
|
||||
IF ErrorMsg NE '' THEN
|
||||
Set_Status(-1,ErrTitle:@SVM:ErrorMsg)
|
||||
RETURN ''
|
||||
END
|
||||
|
||||
RETURN Result
|
||||
|
||||
|
||||
* * * * * * *
|
||||
CodeDesc:
|
||||
* * * * * * *
|
||||
|
||||
PopupID = Parms[1,@RM]
|
||||
Col1Code = Parms[COL2()+1,@RM]
|
||||
ColNo = Parms[COL2()+1,@RM]
|
||||
|
||||
IF PopupID = '' THEN RETURN
|
||||
IF Col1Code = '' THEN RETURN
|
||||
IF ColNo = '' THEN ColNo = 2
|
||||
|
||||
IF NOT(INDEX(PopupID,'*',1)) THEN
|
||||
PopupID = @APPID<1>:'**':PopupID
|
||||
END
|
||||
|
||||
PopupLiteral = XLATE('SYSREPOSPOPUPS',PopupID,PDISPLAY$,'X')
|
||||
|
||||
CONVERT @VM:@SVM TO @FM:@VM IN PopupLiteral
|
||||
|
||||
LiteralCnt = COUNT(PopupLiteral,@FM) + (PopupLiteral NE '')
|
||||
|
||||
CodeCnt = COUNT(Col1Code,@VM) + (Col1Code NE '')
|
||||
|
||||
FOR I = 1 TO CodeCnt
|
||||
Code = Col1Code<1,I>
|
||||
FOR J = 1 TO LiteralCnt
|
||||
LiteralCode = PopupLiteral<J,1>
|
||||
UNTIL LiteralCode = Code
|
||||
NEXT J
|
||||
Result<1,I> = PopupLiteral<J,ColNo>
|
||||
NEXT Cnt
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
* * * * * * *
|
||||
DescCode:
|
||||
* * * * * * *
|
||||
|
||||
/*
|
||||
Pass in Description and associated code is returned.
|
||||
|
||||
Assumes Code is in column 1 and Desc is in column2
|
||||
|
||||
Desc Column can be overriden by passing a number in the options ColNo parameter
|
||||
|
||||
*/
|
||||
|
||||
PopupID = Parms[1,@RM]
|
||||
DescsIn = Parms[COL2()+1,@RM]
|
||||
ColNo = Parms[COL2()+1,@RM]
|
||||
|
||||
IF PopupID = '' THEN RETURN
|
||||
IF DescsIn = '' THEN RETURN
|
||||
IF ColNo = '' THEN ColNo = 2
|
||||
|
||||
IF NOT(INDEX(PopupID,'*',1)) THEN
|
||||
PopupID = @APPID<1>:'**':PopupID
|
||||
END
|
||||
|
||||
PopupLiteral = XLATE('SYSREPOSPOPUPS',PopupID,PDISPLAY$,'X')
|
||||
|
||||
CONVERT @VM:@SVM TO @FM:@VM IN PopupLiteral
|
||||
|
||||
LiteralCnt = COUNT(PopupLiteral,@FM) + (PopupLiteral NE '')
|
||||
|
||||
diCnt = COUNT(DescsIn,@VM) + (DescsIn NE '')
|
||||
|
||||
FOR I = 1 TO diCnt
|
||||
DescIn = DescsIn<1,I>
|
||||
FOR J = 1 TO LiteralCnt
|
||||
LiteralDesc = PopupLiteral<J,ColNo>
|
||||
UNTIL LiteralDesc = DescIn
|
||||
NEXT J
|
||||
Result<1,I> = PopupLiteral<J,1>
|
||||
NEXT Cnt
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
|
||||
* * * * * * *
|
||||
CodePosition:
|
||||
* * * * * * *
|
||||
|
||||
PopupID = Parms[1,@RM]
|
||||
Col1Code = Parms[COL2()+1,@RM]
|
||||
|
||||
IF PopupID = '' THEN RETURN
|
||||
IF Col1Code = '' THEN RETURN
|
||||
|
||||
IF NOT(INDEX(PopupID,'*',1)) THEN
|
||||
PopupID = @APPID<1>:'**':PopupID
|
||||
END
|
||||
|
||||
PopupLiteral = XLATE('SYSREPOSPOPUPS',PopupID,PDISPLAY$,'X')
|
||||
|
||||
CONVERT @VM:@SVM TO @FM:@VM IN PopupLiteral
|
||||
|
||||
LiteralCnt = COUNT(PopupLiteral,@FM) + (PopupLiteral NE '')
|
||||
|
||||
CodeCnt = COUNT(Col1Code,@VM) + (Col1Code NE '')
|
||||
|
||||
FOR I = 1 TO CodeCnt
|
||||
Code = Col1Code<1,I>
|
||||
FOR J = 1 TO LiteralCnt
|
||||
LiteralCode = PopupLiteral<J,1>
|
||||
UNTIL LiteralCode = Code
|
||||
NEXT J
|
||||
Result<1,I> = J
|
||||
NEXT Cnt
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
|
||||
* * * * * * *
|
||||
AllCodes:
|
||||
* * * * * * *
|
||||
|
||||
PopupID = Parms[1,@RM]
|
||||
ColNo = Parms[COL2()+1,@RM]
|
||||
|
||||
IF PopupID = '' THEN RETURN
|
||||
IF ColNo = '' THEN ColNo = 1
|
||||
|
||||
IF NOT(INDEX(PopupID,'*',1)) THEN
|
||||
PopupID = @APPID<1>:'**':PopupID
|
||||
END
|
||||
|
||||
PopupLiteral = XLATE('SYSREPOSPOPUPS',PopupID,PDISPLAY$,'X')
|
||||
|
||||
CONVERT @VM:@SVM TO @FM:@VM IN PopupLiteral
|
||||
|
||||
LiteralCnt = COUNT(PopupLiteral,@FM) + (PopupLiteral NE '')
|
||||
|
||||
FOR I = 1 TO LiteralCnt
|
||||
Result<1,I> = PopupLiteral<I,1>
|
||||
NEXT I
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user