M Web Magazine 007 (June 5, 1998 - September 4, 1998)

MSM-Workstation Tutorial (part 4/5)

by
Chris Bonnici

 

Control Delete — Push

I cExt'="" I $$YN^%msgbox("Are you sure?","Delete Record") D Q
.K ^|"MWMdb"|EXT(cExt)
.Do Init
.Q

Control Ext — Modified

Q:cExt=""
I cExt'?1N.N D Q
.S cExt=""
.%%SetVar(cExt)
.%%NotOK
.Q
D UpdScrn
S ExtChg=1

Control Ext — select

N Array,Key,I
%%GetSel(Ext,Array)
S Key=$O(Array("")),cExt=Array(Key)
%%Enable(MntExt.Name)
%%SetFocus(MntExt.Name)
D UpdScrn

Control Save — Push

N Buf
I cName="" D Q
.D E^%msgbox("Name cannot be left blank","Save")
.%%SetFocus(MntExt.Name)
.Q
I cDept="" D Q
.D E^%msgbox("Department cannot be left blank","Save")
.%%SetFocus(MntExt.Dept)
.Q

N Changed
S Buf=$$ExtLd^MWMLIB(cExt)
S Changed=0
S:$P(Buf,"#",1)'=cName Changed=1
S:$P(Buf,"#",2)'=cDept Changed=1

I Changed D
.S Buf=cName_"#"_cDept
.I '$$ExtFl^MWMLIB(cExt,Buf) D E^%msgbox("Record not filed","Maintain Extensions")
.Q
D Init
Q

 

Bye-Bye

If you would like to share some code with us, zip up your development database and send it over with instructions on what to do. Don’t forget to include in your archive, any icons, graphics, etc that are necessary for the proper functioning of your code.

If you’ve written an application that uses MWM-Workstation and would like us to give you additional coverage in marketing your work, send us an archive and a document on the lines of %ZCBRS.

Our aim at this point is to get you developing in Workstation and we are therefore focusing on sharing with you development tips and tricks. We will soon be adopting a more formal approach to the topic but in the meantime suggest that you check out help, the tutorial on Micronetics’ web site and announcements by Micronetics on this product.

 

Mounting a database.

$$MOUNT^%msv(.<InArgs>,.<OutArgs>) mounts a database that may lie wither on the same computer as the application as is MWMdb. This type of database is called a local database. You can also use this command to link to a database lying on a server. A third option is to load a memory database. This type of database is very fast but not permanent. It is ideal, for example when working with scratch data. This function returns success or failure.

^%msv also has functions directed specifically at the three possible databases. They are LMOUNT, RMOUNT, and MMOUNT.

 

Mounting a local database

<InArgs> must have the following subscripts defined.

Subscript What it does Optional?
DBNAME The database path and name.  
LOCAL_ACCESS Access permissions (N = none, R = read-only, or M = mixed (read/write)) YES
MONIKER Alias name for database YES
UCINAME UCI with which to associate moniker YES
VGNUM Requested index for volume group YES

When mounting a local volume group and DBNAME is not specified, MONIKER must identify a moniker recorded in the application's registry entry, from which the host filename is determined. The volume group index and the volume group name of the mounted volume are returned as output arguments.

 

Mounting a remote database

<InArgs> must have the following subscripts defined.

Subscript What it does Optional?
IPADDRESS Server's IP address  
LOCAL_ACCESS Access permissions (N = none, R = read-only, or M = mixed (read/write)) YES
MONIKER Alias name for database YES
PASSWORD Password  
PORT Server port  
UCINAME Remote UCI name to mount  
VGNAME Remote volume name to mount  

When mounting a remote volume group and IPADDRESS and PORT are not specified, MONIKER must identify a moniker recorded in the application's registry entry, from which the host filename is determined. The address and port are returned as output arguments.

 

Mounting a memory database

<InArgs> must have the following subscripts defined.

Subscript What it does Optional?
BLOCKS Size of the volume group Default 100 blocks
MONIKER Alias name for database YES
VGNAME UCI name to mount database as  
VGNUM Requested index for volume group YES

 

Returned Fields

<OutArg> will contain the following fields is the operation is successful:

Subscript What it means Applies to
LOCAL_ACCESS Access permissions granted (N = none, R = read-only, W = write-only, or M = mixed (read/write)) Remote Mount
SERVER_JOB Job number assigned on server Remote Mount
VGNAME Volume group name  
VGNUM Volume group number  

Continued...

Contact Information

Chris Bonnici

email: chribonn@softhome.net
URL: http://geocities.datacellar.net/SiliconValley/7041
ICQ: 9900205

E&OE

1