Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ISTRANSACTABLE() i wan't a error for empty workarea
Message
From
04/06/2004 10:43:46
 
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro Beta
Miscellaneous
Thread ID:
00909912
Message ID:
00909936
Views:
7

Fabio,

Can you explain why an error is not good for you? By the way, the workaround is simple

? NOT EMPTY(ALIAS()) AND ISTRANSACTABLE()


Difficult to explain it in English well.
I will try.

A first banal cause:
- 90% VFP behaviour not fire a error when the current WA is empty:
RECCOUNT()
RECNO()
TACNO()
DBF()
ISREADONLY()
ISRLOCKED()
FLOCK()
...
- But for me this is not perfect, perfect is return NULL
Hovewer, more serious reasons exists.

Preface:
Empty WA is a normal situation into VFP enviroment

With TRY CATCH i cannot RETRY a command,
then a catch for the 13 - error require a try within a external loop,
complex, and very slow program for a normal situation.

If ISTRANSACTABLE() return NULL or .F. i can to recognize this situation easy:
DO CASE
  CASE ISTRANSACTABLE()
     * ALL OK, I CAN CONTINUE
  CASE ISNULL(ISTRANSACTABLE()) && or EMPTY(ALIAS()) if ISTRANSACTABLE() return .F.
     * now i can fire a my error
      THROW CREATEOBJECT('AliasNotFound')
     * or resolve the situation
     SELECT AliasThatIWantHere
     .....
  OTHERWISE
    
ENDCASE
...
and it could seem equivalent to yours code, but it it is not.

yours code, like this, serves in order to prevent to a error fires:
IF EMPTY(ALIAS())
     * now i can fire a my error
      THROW CREATEOBJECT('AliasNotFound')
     * or resolve the situation
     SELECT AliasThatIWantHere
     .....
ENDIF
IF ISTRANSACTABLE()

ENDIF
My code serves in order to recognize one normal situation and resolve it.

More clear for me into VFP enviroment.

However,
for this behaviour the best choice is not unique,
and there are of the situations where one developer prefers a direct error.

Have VFPT a statistic for do the best choice ?

Fabio
Previous
Reply
Map
View

Click here to load this message in the networking platform