
! script name: datatable.d/rowappendtbls
! topic: merge two tables by appending the rows.

!A
!A NAME:
!A
!A 	Row Append Tables
!A
!A DESCRIPTION:
!A
!A	This script appends the second table to the bottom of the first.
!A
!B INSTRUCTIONS:
!B
!B 	PICK FIRST TABLE: Pick the first table.
!B
!B 	PICK SECOND TABLE: Pick the table which
!B 		is to be appended to the first.
!B
!B NOTE:
!B
!B 	The first table is modified by this function. The second
!B 	table is left unchanged.
!B
!# see also - htdocs/help.d/datatables.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: row append tables ")

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


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

Pick_table2:stat= SetInputFormat("n4","")
Table2=PickEntity("PICK SECOND TABLE")
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Table2) THEN Pick_table2

ActivateUndo
Stat= AdvanceUndoNumber("row append")
Stat= AddItemToUndo(WsUBModifyMode,Table1)

Stat= EraseEntity(Table1)
Stat= RowMergeTables(Table1,Table2)
Stat= PlotEntity(Table1)

GOTO Element_loop

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