
! script name: datatable.d/searchtest

!A
!A NAME:
!A
!A
!A DESCRIPTION:
!A
!A
!B INSTRUCTIONS:
!B
!B
!# see also - htdocs/help.d/datatables.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: searchtest ")

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


Rlast=0
Clast=0
Elast=0
Start:!

Stat=SetInputFormat("a99","")
Stat=GetValue("SEARCH STRING",Answer$)
IF (ExitScript(Destination$)) THEN Leave
Search$= Answer$

Element_loop:!
stat= SetInputFormat("n4","")
Element1=PickEntity("PICK COLUMN")
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Element1) THEN Element_loop
T1= LastPickPara

R1=TableParaRow(Element1,T1)
C1=TableParaColumn(Element1,T1)

R2= StringSearchColumn(Element1,Search$,C1,R1,999,WsTrue)

IF Rlast THEN
	IF ValidGeometry(Elast) THEN 
		Stat= PlotDataTable(Element1,Rlast,Clast,-1)
		Stat= SetEntryHighlight(Elast,Rlast,Clast,WsFalse)
		Stat= PlotDataTable(Element1,Rlast,Clast,0)
	END IF
END IF
IF R2> 0 THEN
	Stat= SetEntryHighlight(Element1,R2,C1,WsTrue)
	Stat= PlotDataTable(Element1,R2,C1,0)
END IF
Rlast= R2
Clast= C1
Elast= Element1


GOTO Start

Leave:!
IF Rlast THEN
	IF ValidGeometry(Elast) THEN 
		Stat= PlotDataTable(Element1,Rlast,Clast,-1)
                Stat= SetEntryHighlight(Elast,Rlast,Clast,WsFalse)
                Stat= PlotDataTable(Element1,Rlast,Clast,0)
	END IF
END IF
stat= SetInputFormat("n4","")
LowerColorBox
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
