
! script name: datatable.d/addrows
! topic: add rows to a table

!A
!A NAME:
!A
!A 	Add Rows
!A
!A DESCRIPTION:
!A
!A 	Add blank rows to the end of a table
!A
!B INSTRUCTIONS:
!B
!B 	PICK TABLE: Select the table to be modified.
!B
!B 	NUMBER OF ROWS ADDED: Number of rows added to the end.
!B
!B NOTES:
!B
!B 	The data in the table is preserved when adding columns or rows.
!B
!B 	To insert blank rows in the interior of a table use insert rows.
!B
!# see also - htdocs/help.d/datatables.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: add rows ")

DIM Answer$[256]
DIM A$[256]
DIM Destination$[256]
DEG


ActivateUndo
Start:!

Element_loop:!
stat= SetInputFormat("n4","")
Table1=PickEntity("PICK TABLE")
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Table1) THEN Element_loop


stat= SetInputFormat("n0=","")
Stat=SetEqualsValue(Nrows)
Nrows= GetValue("NUMBER OF ROWS ADDED",Answer$)
IF (ExitScript(Destination$)) THEN Leave

ActivateUndo
Stat= AdvanceUndoNumber("add rows")
Stat= AddItemToUndo(WsUBModifyMode,Table1)

Stat= EraseEntity(Table1)
Stat= ReDimTableRows(Table1,Nrows,WsTrue)
Stat= PlotEntity(Table1)

GOTO Element_loop

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