
! script name: processtable.d/deleterow
! topic: delete a row in the process table

!A
!A NAME:
!A
!A 	Delete Row in Process Table
!A
!A DESCRIPTION:
!A
!A	This script will delete a row in the process table.
!A
!B INSTRUCTIONS:
!B
!B 	PICK ROW TO BE DELETED: Pick the row to be deleted. 
!B
OPTION BASE 1
stat=ChangeLabelStr("ScriptNameStatus","Function: delete process table row")

DIM Answer$[256]
DIM A$[256]
DIM Destination$[256]
DIM Data_name1$[256],Work_zone1$[256]

IF NOT ValidGeometry("Amo process table") THEN Leave
ActivateUndo
Highlight_pen=2

Element_loop:!
stat= SetInputFormat("n4","")
Table1=PickEntity("PICK ROW TO BE DELETED")
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(Table1) THEN Element_loop
IF IsEntityDependent(Table1) THEN
	Stat= MessageFileBox("/usr/weber/database/messages/vdmprtbl","ERROR")
	GOTO Element_loop
END IF
IF NOT AreEntitiesSame(Table1,"Amo process table") THEN Element_loop

T1= LastPickPara
R1=TableParaRow(Table1,T1)
IF R1= 1 THEN Element_loop

Stat= GetTableEntryStr(Table1,R1,1,Data_name1$)
Stat= GetTableEntryStr(Table1,R1,2,Work_zone1$)

Stat= PlotDataTable(Table1,R1,0,Highlight_pen)

ActivateUndo
Stat= AdvanceUndoNumber("delete row")
Stat= AddItemToUndo(WsUBModifyMode,Table1)
Stat= EraseEntity(Table1)
Stat= DeleteTableRow(Table1,ProcessTableRow(Table1,Data_name1$,Work_zone1$))
Stat= PlotEntity(Table1)
GOTO Element_loop

Leave:!
Stat= SetInputFormat("n4","")
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
