SIMPOL Documentation

Advanced Topics

Now that you have gotten a basic single form and database table package running in single user mode, it is worth thinking about where to go from here. There are a couple of steps that come next:

  • Loading other forms

  • Changing to a multi-user system

Loading other forms turns out to be fairly easy. The basic call is appw.openformdirect("myform.sxf"). The framework takes care of the rest. It is a good idea to open all the required database tables during initialization of the application and ensure they are part of the appwindow object.

Changing to a multi-user system is a bit more complicated. First the database tables need to be opened and shared using a PPCS server. A sample server is included with Superbase NG. It is located in the SIMPOL\Utilities\simpolserver directory. Also in that directory is a file called readme.txt. That file discusses everything necessary to share the database files via PPCS. Once the files are shared, the remaining change that is required is to open them using a PPCS data source.

if bUSEPPCS
  me.ppcs =@ ppcstype1.new(udpport=.nul, error=e)
  if me.ppcs =@= .nul
    wxmessagedialog(appw.w, "Error starting PPCS", sAPPMSGTITLE, \
          "ok", "error")
  else
    src =@ me.opendatasource("ppcstype1", "127.0.0.1:4000", appw, \
          error=e)
    if src =@= .nul
      wxmessagedialog(appw.w, "Error opening the PPCS server", \
          sAPPMSGTITLE, "ok", "error")
    end if
  end if
else
  src =@ me.opendatasource("sbme1", "address.sbm", appw, error=e)
  if src =@= .nul
    wxmessagedialog(appw.w, "Error opening the address.sbm file", \
          sAPPMSGTITLE, "ok", "error")
  end if
end if

if src !@= .nul
  t =@ appw.opendatatable(src, "Address", error=e)
  if t =@= .nul
    wxmessagedialog(appw.w, "Error opening the 'Address' table", \
          sAPPMSGTITLE, "ok", "error")
  else
    me.address =@ t
    ok = .true
  end if
end if
          
        

The above program listing assumes that a boolean constant called bUSEPPCS has been defined earlier in the program. That is all that is required to switch the program to run as a multiple user system, other than a fully licensed database engine, though the 3-user license that is provided with Superbase NG for testing should be sufficient while doing development.