For Programmers: Free Programming Magazines  


Home > Archive > Clipper > June 2004 > processing data entry in tbrowse class









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author processing data entry in tbrowse class
hpy_awad@yahoo.com

2004-06-26, 8:55 pm

How can I validate and check data entry via tbrowse. say

if data_entry_field_data > last_record_field_data
say wrong entry
endif

How can I ask about last records in tbrowse class ?
Gejza Horvath

2004-06-26, 8:55 pm

What is last record?
Last visible record, last record in your DBF or last record available applying the
oBrowser:BottomBlock CodeBlock?
The principle is very simple:
Display the GET, define VALID statement, which processes your condition.

yourVariable := CurrentField_from_dbf
@ ROW(),COL() GET yourVariable PICTURE ..... VALID Testvalidity(yourVariable)
IF LASTKEY() <> K_ESC
....fill the yourvariable content into the DBF
ENDIF

Somewhere else in your program

FUNCTION TestValidity(xValue)

TheRightAlias->(DBGOBOTTOM())
IF Dbf_Data > xValue
RETURN .F.
ENDIF
RETURN .T.

Gejza

"hpy_awad@yahoo.com" <ehab_aziz2001@yahoo.com> pí¹e v diskusním pøíspìvku
news:7ecaee57.0406261210.38213003@posting.google.com...
> How can I validate and check data entry via tbrowse. say
>
> if data_entry_field_data > last_record_field_data
> say wrong entry
> endif
>
> How can I ask about last records in tbrowse class ?



Gejza Horvath

2004-06-27, 3:55 am

OOps, error!
the right code is here:

FUNCTION TestValidity(xValue)
LOCAL nRecno, lReturn

nRecno := TheRightAlias->(RECNO())
TheRightAlias->(DBGOBOTTOM())
IF Dbf_Data > xValue
ALERT("Wrong value")
lReturn := .F.
ELSE
lReturn := .T.
ENDIF
TheRightAlias->(DBGOTO(nRecno))
RETURN .T.

Gejza

"Gejza Horvath" <_hsoftkn@nextra.sk> pí¹e v diskusním pøíspìvku
news:2k66cvF18co5lU1@uni-berlin.de...
> What is last record?
> Last visible record, last record in your DBF or last record available applying the
> oBrowser:BottomBlock CodeBlock?
> The principle is very simple:
> Display the GET, define VALID statement, which processes your condition.
>
> yourVariable := CurrentField_from_dbf
> @ ROW(),COL() GET yourVariable PICTURE ..... VALID Testvalidity(yourVariable)
> IF LASTKEY() <> K_ESC
> ....fill the yourvariable content into the DBF
> ENDIF
>
> Somewhere else in your program
>
> FUNCTION TestValidity(xValue)
>
> TheRightAlias->(DBGOBOTTOM())
> IF Dbf_Data > xValue
> RETURN .F.
> ENDIF
> RETURN .T.
>
> Gejza
>
> "hpy_awad@yahoo.com" <ehab_aziz2001@yahoo.com> pí¹e v diskusním pøíspìvku
> news:7ecaee57.0406261210.38213003@posting.google.com...
>
>



Stephen Quinn

2004-06-28, 3:55 am

hpy_awad

TBrowse has no concept of last record, you query the database driving the
TBrowse.
Eg
nCurrRecNo := DBF->( RECNO() ) // Current RecNo
nLastRecNo := DBF->( LastRec() ) // Total No. of records
IF nLastRecNo = nCurrRecNo
// Do something here
ENDIF

NOTE: The above can change depending on the index and/or filter conditions

--
HTH
Steve Quinn


Pete

2004-06-28, 8:55 am

Ï "Stephen Quinn" <steveqNOSPAM@integritynet.com.au> Ýãñáøå óôï ìÞíõìá
news:2k9masF18h3clU3@uni-berlin.de...
<snip>
> nCurrRecNo := DBF->( RECNO() ) // Current RecNo
> nLastRecNo := DBF->( LastRec() ) // Total No. of records
> IF nLastRecNo = nCurrRecNo
> // Do something here
> ENDIF
>
> NOTE: The above can change depending on the index and/or filter conditions


Are you implying that recno() and lastrec() returned values are affected by
index and/or filters? If so, this hint is, IMO, not accurate.
In your example above, nCurrRecNo and nLastRecNo are 'physical' <work
area's> values
gathered by their relevant functions. They are independent of any filter or
index contitions and thus your ' NOTE ' should read:
NOTE: The above _cannot_ change since it is NOT depending on the index
and/or filter conditions


regards,

---
Pete




hpy_awad@yahoo.com

2004-06-28, 3:55 pm

How to make say to a browse field .

field3:=field2-field1

At tbrowse I want to make say without get to field3 How.....?
Stephen Quinn

2004-06-28, 8:55 pm

Pete

Your right
- I use SIXCDX and use OrdKeyNo() a lot and was confusing the issue in
memory.

--
CYA
Steve Quinn


Stephen Quinn

2004-06-29, 3:55 am

hpy_awad

> How to make say to a browse field .
> field3:=field2-field1


oCol := TBColumnNew( 'VirtualColumn', {|| x->FLD2 - x->FLD1 } )
oCol:Width := 20
oCol:Picture := '9,999.99'
oTB:Add( oCol )

--
HTH
Steve Quinn


Pete

2004-06-29, 3:55 pm

Ï "Stephen Quinn" <steveqNOSPAM@integritynet.com.au> Ýãñáøå óôï ìÞíõìá
news:2kbsmjFhp4oU2@uni-berlin.de...
> Pete
>
> Your right
> - I use SIXCDX and use OrdKeyNo() a lot and was confusing the issue in
> memory.
>


Steve,

you're the champion-contributor of this ng with thousands posts. I think
it's statistically expected for you sometimes to miss a 'shot'.. (or a half)
;->

regards,

---
Pete




Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com