We have a display program similar to the display in airports. We constantly have request from customers that want it customized or they end up creating their own.
I decided the best way to handle it was create a group of functions in SQL Server to do all of the logic of what to display and how to display it, and have the “client” program just be a display. That way they can tweak the SQL function to customize the display
Ended up being 3 functions for a total of 600 lines of code (a lot of that is variable definitions – have I mentioned how much I hate T-SQL versus pl/SQL?) It provides all the data of the display including the background color of the columns based on logic.
I then spent 15 minutes (that right 15 minutes!!!) creating a proof of concept application in WinDev to show the functionality of the function. This includes all the great built in features of WinDev including:
- First 3 Columns are Fixed
- The last 3 columns are mutliline text that shows the first 3 lines by default
- There are tooltips on those last 3 columns to show the full text
- The height of a row can be adjusted to seen the entire text of that row
- Columns can be hidden and moved around
- Autogenerate a report from the display
Here’s a screen shot
And here is the TOTAL code of the WinDev Screen
ConSitDisp is Data Source Linenumber is int SQLStatement is string = [ select * from ConSitDisp('10/17/12',24,'Both',0,1,1,1,1,1) Order by ActionDate ] IF HExecuteSQLQuery(ConSitDisp,MyConnection1,hQueryWithoutCorrection,SQLStatement) = False THEN Info(HErrorInfo()) ELSE FOR EACH ConSitDisp Linenumber++ TableAddLine(TABLE_ConSitDisp,ConSitDisp.ActionDate,ConSitDisp.ActionType,ConSitDisp.CustomerName,ConSitDisp.Fuel,ConSitDisp.Oil,ConSitDisp.CustomField1, ConSitDisp.CustomField2,ConSitDisp.CustomField3,ConSitDisp.CustomField4,ConSitDisp.CustomField5,ConSitDisp.CustomField6,ConSitDisp.CustomField7, ConSitDisp.CustomField8,ConSitDisp.CustomField9,ConSitDisp.CustomField10) SetBackgroundColor(Linenumber,4,ConSitDisp.FuelBackground) SetBackgroundColor(Linenumber,5,ConSitDisp.OilBackground) SetBackgroundColor(Linenumber,6,ConSitDisp.CustomField1Background) SetBackgroundColor(Linenumber,7,ConSitDisp.CustomField2Background) SetBackgroundColor(Linenumber,8,ConSitDisp.CustomField3Background) SetBackgroundColor(Linenumber,9,ConSitDisp.CustomField4Background) SetBackgroundColor(Linenumber,10,ConSitDisp.CustomField5Background) SetBackgroundColor(Linenumber,11,ConSitDisp.CustomField6Background) SetBackgroundColor(Linenumber,12,ConSitDisp.CustomField7Background) SetBackgroundColor(Linenumber,13,ConSitDisp.CustomField8Background) SetBackgroundColor(Linenumber,14,ConSitDisp.CustomField9Background) SetBackgroundColor(Linenumber,15,ConSitDisp.CustomField10Background) TABLE_ConSitDisp[Linenumber,13]..ToolTip = ConSitDisp.CustomField8 TABLE_ConSitDisp[Linenumber,14]..ToolTip = ConSitDisp.CustomField9 TABLE_ConSitDisp[Linenumber,15]..ToolTip = ConSitDisp.CustomField10 END END
PROCEDURE SetBackgroundColor(Linenumber,ColumnNumber,Color) SWITCH Color CASE "Red" TABLE_ConSitDisp[Linenumber,ColumnNumber]..BrushColor = iLightRed CASE "Lime" TABLE_ConSitDisp[Linenumber,ColumnNumber]..BrushColor = iLightGreen CASE "Orange" TABLE_ConSitDisp[Linenumber,ColumnNumber]..BrushColor = iLightYellow END
15 minutes to produce a commercial looking Proof of Concept. You got to love Windev!!!!
[suffusion-the-author display=’author’]
[suffusion-the-author display=’description’]