> >LPARAMETERS cJob_num > > cAlias=alias() > > if not used('Job_Info') > Do Open_Job_Info > else > select Job_Info > endif > > *-- Seek the entered text as a job number --------------- > seek alltrim(cJob_Num) > > > if found() > this.ipkey=ipkey > this.job_num=alltrim(job_num) > this.status=status > this.job_start=job_start > this.invoiced=invoiced > this.po_num=Alltrim(p_o_num) > this.ship_date=ship_date > this.quote_no=quote_no > this.cust_num=alltrim(cust_num) > this.company=alltrim(Customer.Company) > this.phone=Alltrim(Customer.phone) > this.found=1 > this.value=alltrim(job_num) > select (cAlias) > return .t. > else > this.ClearProperties() > if this.complain=.t. > =MessageBox("Job Number " + alltrim(cJob_Num)+ " not found!", 0, 'Notice') > endif > If !Empty(cAlias) > select (cAlias) > endif > return .F. > endif >>
SET ASSERTS ON lcTable = GETFILE() ASSERT .f. oJob = CREATEOBJECT([TableInfo]) oJob.TableName = JUSTSTEM(lcTable) oJob.GetInfo([SomeValue],[TheOrder]) DEFINE CLASS TableInfo AS Session Fields = NULL TableName = [] FUNCTION GetInfo(leSeekExpression, lcOrderName) SELECT (this.TableName) SEEK leSeekExpression IN (this.TableName) ORDER &lcOrderName IF FOUND(this.TableName) SCATTER NAME this.Fields ELSE this.Fields = NULL ENDIF ENDFUNC FUNCTION TableName_Assign(leNewValue) IF NOT USED(leNewValue) USE (leNewValue) IN 0 ENDIF this.TableName = m.leNewValue ENDFUNC ENDDEFINESure that is a VERY rough class but that is just an idea you should put Error handling, check for reliable parameters etc.