Notes
Slide Show
Outline
1
Business-Model Based VRAD
  •    A new approach for creating data systems allows rapid creation of software from specifications of data elements and work flow.  This approach goes a long way toward eliminating all automatic programming steps; only the parts of the application that are truly unique need to be specified


  • J. D. Melvin, Vision Implementers, Inc.
  • March 13, 2001
2
Key Design Features
  • Specify data elements (tables, fields, and classes having symbolic data types [ID, name, memo, …]
  • Specify users, user groups, and access rights to tables and columns [view, edit, add record, …]
  • For each user, specify navigation
  • Standardized interface
  • User interface screens are generated on the fly by the software
3
Levels of the System (1/3)
  • Level 1 – Data: Connect to database, run query, retrieve rows, update, add record, delete record
  • Level 1 – User Interface: Write text and data of various types to the screen, accept typed input, selected input (drop down lists and radio buttons), submit commands (save, cancel, other action), and links (navigation)
  • Level 2: Run queries and display results in a table, run query and display single record in one or more columns on the screen
4
Levels of the System (2/3)
  • Level 3: Create pop down lists from queries, input controls from fields in a single-record query
  • Level 4: Present a search screen, show query in a table based on search criteria, allow rows to be clicked to show detail of individual records, present data for viewing or editing using a common software interface
  • Level 5: Complete standardized user interface framework
5
Levels of the System (3/3)
  • Level 6: A script using the framework that specified
    • Users and groups and their access to data
    • Navigation
    • Find screens
    • Queries to be displayed in record lists
    • What is to be displayed for individual records (including what fields are visible and which can be edited)
    • Cosmetics (logos, headings)
  • Business rules: Cascading deletes, record validation, field initialization and validation are coded in the user-supplied code that works with the framework.  The framework provides a standard interface.
6
Creating the Database
  • The cold-start script
  • Create tables and views
  • Default table structures (date-time and user stamps, optional revision tracking)
  • Fields types are represented symbolically (can be changed and the database rebuilt with new field sizes for the changes symbolic definitions
  • Simple application-specific script runs with a setup framework to create the database
  • Additional scripts can be used to make changes to instances of the database
  • A parameter specifies the target database location
7
Implementation #1: ASP/SQL
  • Active Server Pages (VBSCRIPT)
  • Microsoft SQL database
  • IE and Netscape used for user interface (some features do not work in Netscape – are turned off automatically)
  • The code been implemented in a fully procedural form and with two objects: Application and Framework.  The methods and properties of the framework and required methods and properties for the Application object are specified.


8
Other Implementations (1/2)
  • Other languages and databases can be used:
    • JavaScript (ASP)
    • VFP and other languages (ISAPI – but then session control has to be implemented in the application
  • Other databases can be used:
    • VFP database
    • Access database
    • MySQL (free) database
    • Excel spreadsheets
    • Any ODBC data source
  • Note: Microsoft SQL has most powerful SQL – SQL must be written for lowest common denominator of targets
9
Other Implementations (2/2)
  • Other user interfaces (besides web) can be coded: VFP, Access, text based.  However, the auto formatting features of the HTML interface would have to be coded for these other interfaces to work – the framework draws heavily on them.
10
A Very Simple Case Study – The Application ApplIcation (used by LA-FOX):
(1) Set up Heading and Logo
  • <% '--------------------------set up logo and page title------------------------------------------


  • cCopyright="SynesisAPP.  &#153; and &copy; 1999, 2000, 2001, "+_
  •  "<a href='http://www.VisionImplementers.com'>Vision Implementers</a>.  All rights reserved."
  • cVersion="Version 1.0.0."


  • 'Author: Jonathan D. Melvin, Vision Implementers, Culver City, CA, 8/2000...


  • cApplication="APP"
  • Save "Application",cApplication
  • cDefaultOrganization="APP"
  • cMasterPage=cApplication+".asp“


  • cUsernamePrompt="Email Address:"
  • cLogo="<img SRC='images/lafox.gif'>"
  • cDefaultLogo=cLogo


11
(2) Include framework and post-include setup

  • '---------include framework procedure library and send initial html------------


  • %><!-- #include file="appdsn.asp" --><!-- #include file="fw.asp" --><%


  • cOrganizationName=Bold("Sign up for LA-FOX April 28, 2001 Visual FoxPro Boot Camp")
  • 'reduce session timeouts


  • Server.ScriptTimeout=120 'default is 90 seconds; change to 120
  • Session.Timeout=5 'normally 20 minutes - decrease to 5 minutes
  • 'change colors, add any begin page code, and set bBody=TRUE if <body> command issued
  • cTopBackgroundColor="" '"'#99CFFF'“
  • cLoginMessage=Bold("Application System for "+cOrganizationName)
  • bLoginRequired=TRUE
  • 'bShowOptions=FALSE


12
(3) Create the navigation block on the left
  • '------------------------------------------------the web pages---------------------------------------------------------


  • IF BeginPage THEN 'check if user is logged in


  •   cStatus=Form("Status")
  •   IF cCommand="Submit" THEN
  •     cStatus="Submitted"
  •   END IF
  •   cEditApplication=IIF(cStatus="New Application","Edit Application","View Application")
  •   IF cCommand="Edit Application" AND cStatus="New Application" THEN
  •     bEditRecord=TRUE
  •   END IF
  •   'handle logout and switching between view and edit mode
  •   DoLogin cCommand                                            ‘handle login/logout
13
(4) Navigation block continued


  • IF Header THEN


  •   IF FirstCommands() THEN
  •     ‘ for administrators only:
  •     IF cGroup="SYSTEM" OR cGroup="DBMS" THEN
  •       DrillDown "Applications","Applications","",""
  •       IF cGroup="DBMS" THEN
  •         NewLine
  •         Command "Utilities" 'restrict access – has general query capability
  •       END IF
  •       IF Toggle("Lists") THEN
  •         SubCommand "Payment Types"
  •         SubCommand "Status"
  •       END IF
  •     ELSE
  •       Command cEditApplication
  •       IF cStatus="New Application" THEN
  •         Command "Submit Application"
  •       END IF
  •   END IF
14
  (5) Home/welcome/help screen
  •   'Home Page
  •    IF cCommand="Home" OR cCommand="“ THEN
  •     EndControlButtons
  •       BeginBox "",""
  •       Title "Welcome to the "+cOrganizationName+" Application System"
  •       NewLine
  •       Subtitle "Brief Instructions for Use of the System:"
  •       NewLine
  •       Write "Please fill in your application.  Once it is complete, select"
  •       Write "Submit Application at the left."
  •       IF FALSE THEN
  •         Write "  If you have selected on-line payment,"
  •         Write "click the button below to go to PayPal and enter your Visa or Mastercard"
  •         Write "payment.  "
  •       END IF
  •       Write "  If you selected pay by check, mail your check to LA-Fox."
  •       NewLine
  •       NewLine
15
(6) Home/welcome/help screen continued
  •   Write "After submitting your application, you may still log on a view your"
  •       Write "application, but you may not make any further changes.  Contact LA-Fox"
  •       Write "if you need any assistance."
  •       NewLine
  •       Center
  •       NewLine
  •       EndBox
  •       SetupViews                    ‘give user access to tables
16
(7) Administrators: Look up and review applications
  •   ELSEIF BeginFindForm("Applications","Applications","Email_") THEN
  •       SearchField "Email address includes:","EmailAddress",25,"Email_","CN" 'CN=contains
  •       SearchField "First name includes:","FirstName",25,"First_Name","CN"
  •       SearchField "Last name includes:","LastName",25,"Last_Name","CN"
  •       SearchField "Address includes:","Address",25,_
  •         "Address1_+ISNULL(Address2_,'')+ISNULL(City_,'')+ISNULL(State__lookup_,'')","CN"
  •       SearchEqualsPopup "Status:","StatusSelection",_
  •         "SELECT Value_,Caption_ FROM Status_ ORDER BY Order_","Caption_",_
  •          "Value_",TRUE,"Status__lookup_"
  •       SelectLinesPerPage
  •     EndCommandForm "List applications"


  •   'must follow BeginFindForm
  •   ELSEIF DoDrillDown("Applications",_
  •    "Application for %FIRST_NAME% %LAST_NAME%, email %EMAIL_%","Application",FALSE,"") THEN


17
(8) Find and edit your application
  •   ELSEIF CommandPage(cEditApplication,"Home") THEN
  •     AddRow "View.Application","Application for "+cUsername,"New Application for "+cUsername,"Home",1,TRUE
  •     IF cStatus<>"New Application" THEN
  •       NewLine
  •       NewLine
  •       Write Bold("Application has been submitted.  No more edits allowed.")
  •     END IF
  •   ELSEIF CommandPage("Submit Application","Home") THEN
  •     BeginDetailForm BuildCommand("Submit")
  •       NewLine
  •       NewLine
  •       Write Bold("Are you sure you are finished preparing application? "+_
  •         "If so,<br>click Submit below.  Otherwise, click button at left to log out.")
  •       NewLine
  •       NewLine
  •       Command "Submit"
  •     EndForm
18
(9) Submit your application
  •   ELSEIF CommandPage("Submit","Home") THEN
  •     Execute "UPDATE Application_ SET Status__lookup_='Submitted' WHERE _ _ID="+Form("View.Application_ID")
  •     NewLine
  •     NewLine
  •     Title "Application Submitted."
  •   ELSEIF cGroup<>"SYSTEM" AND cGroup<>"DBMS" THEN
  •   ELSEIF EditLookup("Payment Types") THEN
  •   ELSEIF EditLookup("Status") THEN
  •   ELSEIF cGroup<>"DBMS" THEN
  •   ELSEIF Utilities("Home") THEN
  •   END IF
  • END IF ‘if user not logged in, login screen is presented and page ends
  • EndPage 'otherwise end the page here
19
(10) Procedures for this application: Access rights
  • '----------------------------------------Data Access---------------------------------------------------
  • 'set up for table-name,can-edit,can-add,can-delete,can-edit-all-fields


  • SUB SetupViews
  •   DIM bEnable
  •   bEnable=IIF(cGroup="SYSTEM" OR cGroup="DBMS",TRUE,FALSE)
  •   InitializeQueryView "View.Applications",bEnable,(cGroup="DBMS"),bEnable,bEnable
  •   InitializeQueryView "View.Application",TRUE,TRUE,bEnable,TRUE
  •   InitializeQueryView "Lookup_Payment_Type",bEnable,bEnable,bEnable,bEnable
  •   InitializeQueryView "Lookup_Status_",bEnable,bEnable,bEnable,bEnable
  • END SUB



20
(11) Procedures: Define list and record detail views
  • 'get select statement for table view (overview) cViewName


  • FUNCTION GetViewData(cViewSelected)
  •   cViewName=cViewSelected
  •   nColumns=IIF(bEnableEdit,1,2)
  •   nMaxTxtBoxWidth=75
  •   'ViewParameters view, table,
  •   '   overview-fields,
  •   '   joins, where,
  •   '   order-by, detail-fields,
  •   '   detail-joins, detail-where,
  •   '   max-text-box-width, number-of-columns


21
(12) Continued
  •   IF ViewParameters("View.Applications","Application_",_
  •     "Email_,First_Name,Last_Name,_CreateDate AS Date_Created,"+_
  •       "_ModifyDate AS Date_Last_Modified,Group_,Status__lookup_",_
  •     "",IIF(cGroup="DBMS","","Group_<>'DBMS'"),_
  •     "","*",_
  •     "","",_
  •     nMaxTxtBoxWidth,nColumns) THEN
  •     'Groups are DBMS, System, Applicant
  •     IF bAdd THEN
  •       SetupLookup1 "Group_","Group_","Group","Value_","Caption_","",IIF(cGroup="DBMS","","Value_<>'DBMS'")
  •     ELSE
  •       cDoNotEdit_1="Email_"
  •       cDoNotEdit_2="Group_"
  •     END IF
22
(13) Continued
  •     'dimensions of tabbed edit area in pixels
  •     cCaptionCellWidth="180"
  •     cLayerTableWidth="560"
  •     cLayerTableHeight="300"


  •     cTab1="Name"
  •     cTab2="Address"
  •     cTab3="Session/Payment"


  •     cTab2Field="Address1_"
  •     cTab3Field="Preferred_Session_lookup_"
23
(14) View/edit your application
  •   ELSEIF ViewParameters("View.Application","Application_",_
  •     "",_
  •     "","",_
  •     "","*",_
  •     "","Email_='"+cUsername+"' AND Status__lookup_='"+cStatus+"'",_
  •     nMaxTxtBoxWidth,nColumns) THEN
  •     cHideField_1="Group_"
  •     'dimensions of tabbed edit area in pixels
  •     cCaptionCellWidth="180"
  •     cLayerTableWidth="560"
  •     cLayerTableHeight="300"


  •     cTab1="Name"
  •     cTab2="Address"
  •     cTab3="Session/Payment"


  •     cTab2Field="Address1_"
  •     cTab3Field="Preferred_Session_lookup_"
24
(15) View/edit the list of payment types
  •   ELSEIF ViewParameters("Lookup_Payment_Types","Lookup_Payment_Type",_
  •     "*",_
  •     "","",_
  •     "Order_","*",_
  •     "","",_
  •     nMaxTxtBoxWidth,1) THEN
  •     nDefaultIncrement=0
25
 (16) View/edit the list of application status values
  •   ELSEIF ViewParameters("Lookup_Status_","Lookup_Status_",_
  •     "*",_
  •     "","",_
  •     "Order_","*",_
  •     "","",_
  •     nMaxTxtBoxWidth,1) THEN
  •     nDefaultIncrement=0
  •   END IF
  • END FUNCTION


26
(17) Get information from user table at login time
  • 'get user-specific data from login table - return TRUE if false if person is logged out


  • FUNCTION GetUserData
  •   SQLNoDebug "SELECT _ID,Email_,RTRIM(ISNULL(Group_,'')) AS "+_
  •    "Group_,Password_,Status__lookup_ FROM Application_ WHERE "+_
  •    "Email_='"+cUsername+"' AND Password_='"+cPassword+"'"
  •   IF oRS.EOF THEN
  •     IF cUsername="" THEN
  •       'log the user out, but do allow access to the page
  •       Logout
  •       GetUserData=TRUE
  •       LoginOptions
  •     ELSE
  •       Close
  •       SQLNoDebug "SELECT Email_,Password_ FROM Application_ WHERE "+_
  •         "Email_='"+cUsername+"'"
27
(18)  If login not found, make sure it is a email address, and create login record
  •       IF oRS.EOF THEN
  •         IF INSTR(cUsername,"@")>0 AND LEN(cPassword)>=4 THEN
  •           oConn.BeginTrans
  •           AddRecord "View.Application","Email_,Group_,Password_,Status__lookup_",_
  •             "'"+cUsername+"','Applicant','"+cPassword+"','New Application'"
  •           NewLine
  •   NewLine
  •   Center
  •   BeginBorder
  •           BeginBox "cellpadding=5 width=300 cellspacing=3","bgcolor="+cLightBlue
  •             Write Bold("Application with email address "+cUsername+" was added to the database.  Please log in again.")
  •           EndBox
  •           EndBox
  •           NewLine
  •           NewLine
  •         ELSE
  •           LoginOptions
  •         END IF
28
(19) Send mail if user has forgotten password
  •       ELSE
  •         IF cPassword="" THEN
  •           cPassword=oRS("Password_")
  •           Close
  •           Execute "master.dbo.xp_sendmail @recipients='"+cUsername+"',_
  •             @Subject='LA-FOX Application',@message='"+_
  •             "Your LA-FOX Visual FoxPro Boot Camp application password is "+_
  •             RTRIM(cPassword)+_
  •             ".  Please go to https://www.VisionImplementers.com/app/app.asp "+_
  •             "to continue working on your applcation.'"
  •           NewLine
  •           NewLine
  •           Center
  •   BeginBorder
  •           BeginBox "cellpadding=5 cellspacing=3","bgcolor="+cLightBlue
  •             Title "Your password has been emailed to you."
  •           EndBox
  •           EndBox
29
(20) Force a new log in after sending email
  •       BeginDetailForm BuildCommand("Login")
  •             Hidden "Username",""
  •             Hidden "Password",""
  •             Button "Log in","Return to Login Screen",""
  •           EndForm
  •           NewLine
  •           NewLine
  •           OutputPage
  •         END IF
  •       END IF
  •     END IF
  •     Save "Username",""
  •     Save "Password",""
30
(21) Handle successful login
  •   ELSE
  •     cGroup=UCASE(RTRIM(oRS("Group_")))
  •     Save "View.Application_ID",CSTR(oRS("_ID"))
  •     cStatus=RTRIM(oRS("Status__lookup_"))
  •     Save "Status",cStatus
  •     GetUserData=TRUE
  •   END IF
  •   Close
  • END FUNCTION
31
(22) Display login options box at top of screen
  • SUB LoginOptions
  •   Center
  •   BeginBorder
  •   BeginTable "cellpadding=5 cellspacing=1"
  •     BeginRow ""
  •       BeginCell "nowrap valign=top bgcolor="+cLightRed
  •         Title "New Application?"
  •       EndCell
  •       BeginCell "bgcolor="+cLightBlue
  •         Write Bold("To create a new application, enter your email address and a<br>"+_
  •           "password of your choice having at least four characters below.")
  •       EndCell
  •     EndRow
  •     BeginRow ""
  •       BeginCell "nowrap valign=top bgcolor="+cLightRed
  •         Title "Forgot Password?"
  •       EndCell
32
(23) continued
  •       BeginCell "bgcolor="+cLightBlue
  •         Write Bold("If you have forgotton your password, "+_
  •           "enter your email<br>address and a blank "+_
  •           "password below and your password will<br>be emailed to you (if we"+_
  •           " find your application in the database).")
  •         NewLine
  •         NewLine
  •       EndCell
  •     EndRow
  •   EndTable
  •   EndBox
  • END SUB


  • SUB BeginBorder
  •   BeginBox "cellspacing=0 bgcolor=black",""
  • END SUB
  • %>
33
Sample Applications
  • LA-Fox Boot Camp Application
  • School System
  • Site Maintenance System
  • Site Monitoring System
  • Project System
  • Culver City Chamber of Commerce