Adding a Lot of Capabilities to My Web App
Today I spent the entire day changing the way in which data sets are selected for display on the graph. Doesn't sound like much - but Holy Cow! it was a ton of work. The page was a relatively simple volatility by strike viewer, but the users wanted to be able to see any set of product/expiration pairs on the graph. At the start of this, I was allowing them to see any set of expirations for a given product.
Big difference.
The problem was really two parts: creating the GUI for the selection process, and then modifying the SQL to get the sets of data, and then coalesce them into one final data set.
The way I solved the first problem was to have a traditional selection drop-down set: the portfolio, the product and the expirations. These all made referential sense: change the portfolio and the products would be updated. Change a product, and the expirations would be updated to reflect that product. It allows for the selection of a single, 'tuple'.
I then had 'Add' and 'Remove' buttons between this on the right, and a single-select multi-line HTML SELECT on the left. The user could then 'create' a tuple, 'add' it to the list, and if there was one thing in the list they didn't want, they could select it and 'remove' it. It works pretty well, I have to say. Not amazing, but it's clean, simple, and almost everyone will understand how to use it immediately.
The second problem was how to get all this data into a single, coherent, data set. The answer was pretty simple: don't. What came to me was the idea that each of the tuples could be easily turned into a DataTable, and then I can put all those tables into a list and iterate over them, and then through the table. It's really a lot like the code I had to run through the JDBC ResultSet, but this time it's a nested loop.
In the end, I had just what I needed, but it took a lot of time to get all the features of the GUI right, and to get the servlet working properly. There was an additional wrinkle in that one of the users wanted to be able to specify the way in which the strikes would be placed on the same x-axis. Hey... it's silly, but it's a user, and that's what I do.