I.T. Discussion Community!
-Collapse +Expand

Paradox

Search Paradox Group:

Advanced
-Collapse +Expand Paradox Group Home
-Collapse +Expand Message Board
-Collapse +Expand Paradox KB
-Collapse +Expand Paradox To/From
To/FromCODEGuides
-Collapse +Expand Paradox Study Test
PRESTWOODCERTIFIED
-Collapse +Expand Paradox Store
PRESTWOODSTORE
-Collapse +Expand Members Only

Prestwood eMagazine

Subscribe now! It's Free!
Enter your email:

   ► MB LobbyCorel Paradox / ObjectPAL Coding BoardObjectPAL Topic     Print This   

How to avoid returning

How to avoid returning in ObjectPAL topic (part of our Corel Paradox / ObjectPAL Coding group).

Quick Search: returning   How avoid   How avoid returning  

Leo
I have a method IsConsistent(tableName)Logical that has to return true or false to indicate the consistency of a table and if consistent perform some editing on it. The function needs to open the table by first as a TCursor. Usually I’ve used this trick that Jedstar showed me to run a switch with case not tc.open(tableName) : showError() return. The problem is that I can’t return false if the Tcursor can’t open or can’t get in edit mode because that is different from an inconsistent table. An inconsistent table needs different operations done on it that a non-opening table shouldn’t get. How should I handle the error of the table not opening to show that consistency checking was not done now?
Another Leo
_ _ ___________________ _ _
We are Micro$oft
You will be assimilated
Resistance is futile
 Posted 9 years ago (Thread Starter)
Comment Quote
Location=Civilized Africa ,  Joined=10 years ago   MB Posts=96  
More... -Collapse +Expand
Leo
Civilized Africa
Rank: Ensign
Email A E USA
Approved member.
Member subscribes to this thread with a verified email.

Post ID #9045, 2 replies
Thread Started 2/13/2003 9:36:00 PM
View Counter=299

CliffSuttle
Well, if it was me, I would just return a string. The call would look something like this:

var
retVal string
endVar

retVal = isConsistant(tableName)
switch
case retVal = "System Error":
; take action
case retVal = "Consistant":
; take action
case retVal = "Inconsistant":
; take action
endSwitch

Then your method with return a string instead of a logical. This also makes your code very easy to read.

Cliff Suttle
Antler Software Technologies
www.AntlerSoftware.com
Cliff's Corner Author, Prestwood eMag

 Posted 9 years ago
Comment Quote
Location=Michigan ,  Joined=11 years ago   MB Posts=90   KB Posts=4  
More... -Collapse +Expand
CliffSuttle
Michigan
Rank: Cadet 2nd Year
Email A E MI USA
Approved member.
Member subscribes to this thread with a verified email.
About CliffSuttle

Mr. Suttle is the President of Antler Software Technologies and is one of the leading authorities on relational data bases in the mid-west. He has been working with Paradox since version 1.0 for DOS (circa 1987).


Post ID #9046 (Level 1.1)  Reply to 9045
Thread Started 2/13/2003 10:09:00 PM
View Counter=2
Most Recent Post

Tony M
I have moved to ALWAYS (well, almost) returning a logical.

And passing a parameter on the command line to handle this situation.

IsConsistent(tableName, stReturn) Logical

You can still return a logical True/False, then if False handle the stReturn.
if not isConsistent("myTable.db",stReturn) then
switch
case stReturn="I" : handleInconsistent()
case stReturn="E" : handleError()
endswitch
endif
That way, if consistent no further action is taken; the switch only activates on a return of False.

Not a lot different than Cliff's methodology. I do it for consistency. But then much of my coding is for OTHERS who use my products; this makes it a little easier for them to know how to use my products - consistently. They can automatically code calls to my library methods as logical returns, and handle the last parameter as the exception/error/code.
 Posted 9 years ago
Comment Quote
Location=Salt Lake City, UT,  Joined=10 years ago   MB Posts=226  
More... -Collapse +Expand
Tony M
 (Inactive)
Salt Lake City, UT
Rank: Cadet 1st Year
Email Deceased E USA
Inactive member.
Member does not subscribe to this thread.
Post ID #9051 (Level 1.2)  Reply to 9045
Reply Posted 2/14/2003 6:12:00 AM

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post:

Enter your name and security key.

Your Name:
Today's security key = P197A
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #9045 Counter
299
Since 4/2/2008
769 People Online Now!!  
Online Now: 767 Guests, 2 Members: Batgirl  DanHo   
Online Today: 2 Members: Batgirl  DanHo =Coder  
@Paradox Group Today:  0 Guests, 1 Members: DanHo   
Show More...
Follow PrestwoodBoards on: 


©1995-2012 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech

 
-
  Load Time=1 seconds.
 
Print This
-
 
Have a question? Need our services? Contact us now.
--Mike Prestwood

Call: 916-726-5675

email: info@prestwood.com