Normal Topic Reuse of User Defined Functions and Procedures (Read 985 times)
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Reuse of User Defined Functions and Procedures
Feb 12th, 2009 at 8:02pm
Print Post Print Post  
User Defined Functions and Procedures can be used repeatedly in the same layout after placing them Global area. Is there anyway it could be used by other Layout of the same application without placing it in the Gobal area of that Layout. May be something like #Include switch. If it can be, How? Does it save any time in compiling the code?  Thank you.
  
Back to top
 
IP Logged
 
Ben
Lantica Support
*****
Offline



Posts: 218
Joined: Apr 7th, 2005
Re: Reuse of User Defined Functions and Procedures
Reply #1 - Feb 12th, 2009 at 8:35pm
Print Post Print Post  
Hello Bharat,

You can use #Include to include an external file containing SBasic programming, but you will still experience roughly the same amount of initial load time (when first opening the application).
  
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Reuse of User Defined Functions and Procedures
Reply #2 - Feb 12th, 2009 at 8:42pm
Print Post Print Post  
Thanks Ben, for clarification. Is there anyway we can just include the procedure part or the Function part with #Include? What is the syntax of including the file with #include ? Thanks.
  
Back to top
 
IP Logged
 
Ben
Lantica Support
*****
Offline



Posts: 218
Joined: Apr 7th, 2005
Re: Reuse of User Defined Functions and Procedures
Reply #3 - Feb 16th, 2009 at 3:02pm
Print Post Print Post  
#include will include the contents of the specified file.

For Example:
#include "sbasic_include.sbas" will include the complete contents of sbasic_include.sbas


More Information on #include can be found on page 85 of the 2.0 Programming Guide
« Last Edit: Feb 16th, 2009 at 5:21pm by Ben »  
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Reuse of User Defined Functions and Procedures
Reply #4 - Feb 16th, 2009 at 7:28pm
Print Post Print Post  
Suggest keeping your own functions in your own file vs adding them to "sbasic_include.sbas"

That will protect your functions from being overwritten by a new sbasic_include.sbas file with a Sesame upgrade.  Putting them on a shared folder will enable all network users to use the functions in a single file.

So you can have two Includes, one for the std Sesame file, and one for your own file:
#include "sbasic_include.sbas" will include the complete contents of sbasic_include.sbas
#include "sbasic_myfiles.sbas" will include the complete contents of sbasic_myfiles.sbas where you have your functions stored.  If the file is not in the same path as "sbasic_include.sbas", then include the full path.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Reuse of User Defined Functions and Procedures
Reply #5 - Feb 16th, 2009 at 9:15pm
Print Post Print Post  
Thanks Bob.
  
Back to top
 
IP Logged