Hi, everyone! First off, I want to apologize for running a bit short on time at the Revelation User Conference last week; who knew that moving large boxes of data would take so long? I'm sure it was the cereal communications that caused the bottleneck…
Anyway, although I didn't have a chance to go through all the lines of code in the O4W stored procedure I demonstrated, I'm hoping that putting an annotated version here on the Works site might at least give you all a few more details of how O4W works. This code will also be in the Quick Start Guide when 9.2 is released, but for now…enjoy!
Subroutine O4W_REVSHOW(CTLENTID, EVENT, REQUEST) * * Build an O4W Stored Procedure to make Penn & Teller reservations * * Demonstrated at Revelation Software User Conference 04/2010 * NOTE: for this to work you will need (in addition to the standard O4W files): * 1. The "template" named tickets.html, and * 2. The "youtubin" plugin * * * Insert our required equates * $Insert O4WCOMMON $Insert O4WEQUATES * * Respond to the various events that our O4W form generates * Begin Case * Every form is called with the "create" event when it starts up Case EVENT _EQC "CREATE" * Specify the location of the "template" we want to use for this form O4WForm("C:\TEMP\tickets.html") * Add in the "js" (javascript) and "css" (style sheets) for any of our plugins O4WScript("../plugins/date_input/jquery.date_input.min.js") O4WStyleSheet("../plugins/date_input/date_input.css") O4WScript("../plugins/youtube/jquery.youtubin-1.js") * What do we want to show at the top of our browser page? O4WTitle("Penn & Teller Reservations") * Convert our sections into tabs O4WTabs("orderTabs", "showing":@VM:"reserve", "Select A Show":@VM:"Reservation Details") O4WSectionStart("showing", O4WMarkedStyle('','0')) * Put up a button to hide or show our on-line help O4WButton("Show/Hide Instructions...", "BTN_HELP") * Build the on-line help into a special section O4WSectionStart("helpSection") O4WText("You should put some help text here. It would make everyone's life much easier!") O4WSectionEnd("helpSection") * When the form starts up, make sure the help section is hidden O4WQualifyEvent("", "hide", "helpSection") * Enable the pure client-side "toggling" of the help section when the help button is clicked O4WQualifyEvent("BTN_HELP", "toggle", "helpSection", "1") * Output a newline so things look nice O4WBreak() * Lay out our show information as a table so it looks nice as well O4WTableStart("showInfo") O4WSetCell(1,1) O4WText("Show date:") O4WSetCell(1,2) * Build a textbox with the current date as the default value * The textbox will be 10 characters wide, it will be named "DATE", and * it will have a unique ID of "txtDATE" O4WTextbox(Oconv(DATE(), "D4/"), 10, "", "DATE", "txtDATE") O4WSetCell(2,1) O4WText("Number of tickets:") O4WSetCell(2,2) * Build a textbox with "0" as the default value * The textbox will be 5 characters wide, and will accept no more than 5 characters * It will be named "NUMTICKETS" and have the unique ID of "txtNUMBER" * When the form is submitted, or validated, the textbox will be checked to make sure only numeric data * is present - and that something is, indeed, present O4WTextbox("0", "5", "5", "NUMTICKETS", "txtNUMBER", O4WValidateStyle('', O4W_VALIDATE_NUM$, "1")) O4WSetCell(3,1) O4WText("Total Cost":@VM:"($49.99/seat):") O4WSetCell(3,2) O4WText("$0.00", "lblCost") O4WSetCell(3,3) * We'll put up a button labeled "Update"... O4WButton("Update", "BTN_UPDATE") * ...that will generate a "click" event when pressed O4WQualifyEvent("BTN_UPDATE", "CLICK") O4WTableEnd("showInfo") O4WSectionEnd("showing") * In the next section let's collect the "demographic" data for the buyer O4WSectionStart("reserve", O4WMarkedStyle('','0')) O4WTableStart("demoInfo") O4WSetCell(1,1) O4WText("Name:") O4WSetCell(1,2) O4wTextbox("", "", "", "NAME") O4WSetCell(2,1) O4WText("Address 1:") O4WSetCell(2,2) O4WTextbox("", "", "", "ADD1") O4WSetCell(3,1) O4WText("Address 2:") O4WSetCell(3,2) O4WTextbox("", "", "", "ADD2") O4WSetCell(4,1) O4WText("City:") O4WSetCell(4,2) O4WTextbox("", "", "", "CITY") O4WSetCell(4,3) O4WText("State:") O4WSetCell(4,4) * Build a listbox with the state information: first, read the state names and codes... states=Xlate("O4WCODES", "CODES_STATES", "", "X") * ...and then pass them into a listbox named "ST" O4WListbox(states, states, "ST") O4WSetCell(5,3) O4WText("ZIP:") O4WSetCell(5,4) O4WTextbox("", "", "", "ZIP") O4WTableEnd("demoInfo") O4WSectionEnd("reserve") O4WSectionEnd("orderTabs") O4WBreak() * Outside of the tabs, display a "Make Your Reservation" button and a link to YouTube o4wTableStart("displayTable", O4WMarkedStyle('','0')) O4WButton("Make Your Reservation!", "BTN_RESERVE") O4WSetCell(1,2) url=http://www.youtube.com/watch?v=_qQX-jayixQ&NR=1" O4WLink("Watch a clip!", O4W_LINKTYPE_NORMAL$, url, "", "lnkPT") O4WTableEnd("displayTable") * When the "BTN_RESERVE" is clicked, it will generate a "SUBMIT" event * (which is like a CLICK event, but it also performs any validation) O4WQualifyEvent("BTN_RESERVE", "SUBMIT") * Turn our textbox (with the ID "txtDATE") into a "date picker" field by using * the "date_input" plugin O4WPlugin("txtDATE", "date_input") * Turn our Penn & Teller link (with the ID "lnkPT") into an embedded video by * using the "youtubin" plugin O4WPlugin("lnkPT", "youtubin") * The CLICK event was generated by the BTN_UPDATE Case EVENT _EQC "CLICK" * Let O4W know we're building a response (and not a full page) O4WResponse() * Pull in the value of the NUMTICKETS field numTickets=O4WGetValue("NUMTICKETS") If Num(numTickets) And numTickets "" then * Had a valid number; calculate the cost and update the lblCost control * Note the use of the O4WResponseStyle to tell the control we're only * updating its text portion O4WUpdate("lblCost", Oconv(numTickets * 4999, "MD2,$"), O4WResponseStyle('','1')) End Else * Didn't have a valid number - show an error message O4WError("You must enter a valid number to continue") End * The SUBMIT event was generated by the BTN_RESERVE Case EVENT _EQC "SUBMIT" * After a SUBMIT, we do have to build a new page - so we'll call O4WForm with * our template again O4WForm("C:\TEMP\tickets.html") * Load in the data from the form numTickets=O4WGetValue("NUMTICKETS") NAME=O4WGetValue("NAME") amt=Oconv(numTickets * 4999, "MD2,$") * Imagine that we get all the rest of the info from the form too... * ...and write it out somewhere in the database * Now generate a thank you message O4WText("Thanks, ":NAME:"! Please be sure to complete your purchase using PayPal and your tickets will be waiting for you at the 'All Call' box") * And call the PayPal site (with the O4WPayPal api) to do a "buy it now" transaction O4WPaypal("BUY", "", "[email protected]", "Penn and Teller tickets", "pttickets", NUMTICKETS, "$49.99", "$0.00", "$0.00") End Case * Return 0
Thanks Bryan,
Just a quick thank you for a great presentation. O4W is really REALLY exciting.
I'm now working on my first O4W app, and loving it!
regards,
Dave G
Bryan - yes, what David said.
Dashboards: are they a candidate for O4W, otherwise how do "you" recommend they be developed?
Cheers
Hi Martin,
Dashboards are part of O4W. You can create a dashboard from either a Wizard or by using the API's.
Regards,
Bob
Martin,
Grab the 'O4W Quick Start Guide'. Dashboards are right up there - after forms, reports - sooo easy.
O4W is a real brilliant piece of work - am eager to roll this out and just chaffing at the bit, awaiting 9.2 release.
Right now just working thru Bryan's script to see if I can run it up and learn more.
Richard
Unfortunately I was unable to attend the conference so I missed Bryan's presentation. However I have been playing around with O4W and I am quite impressed. Fans of RDesign in Rev will be happy.
I assumed that O4W was to provide a web like OI system for "users" to access inhouse or "away from office"
If we are also providing 'Public" access interfaces, is the Application like 'Web Page' acceptable for customers.
Or have I missed something.
G'day Barry,
O4W can build any type of Web site you like, so yes, you can build front facing customer oriented fully interactive web sites using O4W.
For those in the Asia Pacific region who could not make it to the conference, Revelation will be running Road Shows in Australia and New Zealand in the third quarter of 2010. Further details and dates to follow in June.
Dave G
I am also hoping to run a road show event in the UK (probably London) for everyone in the EMEA region. Watch my blog for dates, but I hoping (??) to only keep you waiting until towards the end of June.
M.
Podcasted??