🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac.databases
Article #7

Re: beginner 4d questions

#7
From: Sami Hero
Date: Wed, 28 Oct 1992 08:37
57 lines
2036 bytes
Hi,

Firstly - you shold not use the Default file command, use instead the
longer format like Input layout({File[;"LayoutName"). This way you can
keep control of what is happenin even in very big procedures.

Secondly  when you use menus and menu commands you shold set up a 
separate procedure to start up your "real" functional procedure:

Menu command "Add" has a procedure mAdd connected:

mAdd:

Make variable definitions
Make variable initialization
Get number for the new ID a function
return value:=fAddRecord(parameters like ID)
if (return value=vOK)
			DoSomething
else
	DoSomethinElse like clean up the mess
end if

'end of procedure

fAddRecord is a function with parameter for ID #

c_longint($1)

create record({FileName[)
{FileName[idField:=$1
save record
modify record
if (OK=1)
	$0:=vOK
else
	delete record()
	$0:=vNotOK
end if

--
Making prorammes modular and more generic by the help of pointers
keeps your code more maintainable and more understandable. It also
makes it better ready for the 4D Server (keeping the procedures short).

The problem is that this kind of programming takes some time thinking
problems over and making the design but it also saves lots of time
in debugging.

Best regards,

Sami Hero

*****************************************************************************
*** 		Sami Hero - managing director of HeroCom      		  ***
*** 	"Effective use of the best Database system - 4th Dimension will   ***
***	put us into leading position in Finland's Consulting business"    ***
Technical Details
Message-ID: <1992Oct28.083710.21228@nntp.hut.fi>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!news.funet.fi!funic!nntp.hut.fi!saha.hut.fi!t36269v
References: <Oct.27.10.45.05.1992.6376@gandalf.rutgers.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.mac.databases
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!news.funet.fi!funic!nntp.hut.fi!saha.hut.fi!t36269v
From: t36269v@saha.hut.fi (Sami Hero)
Subject: Re: beginner 4d questions
Message-ID: <1992Oct28.083710.21228@nntp.hut.fi>
Sender: Sami Hero
Nntp-Posting-Host: saha.hut.fi
Organization: Helsinki University of Technology, Finland
References: <Oct.27.10.45.05.1992.6376@gandalf.rutgers.edu>
Date: Wed, 28 Oct 1992 08:37:10 GMT
Lines: 57