vchris Posted June 8, 2009 Share Posted June 8, 2009 I'm redesigning the website and DB at work. Here's how it works.I changed the DB so all the data is in one table, instead of 2-3 previously. I also changed the unique id to a no unique ids. Now the ids are the gid combined with the year field. This will give you 1 row. This way any table can be updated or reloaded from scratch without any unique id issues.The problem is when attempting to generate of the results table. There's 26 different substances. Here's a sample: CO2, N2O, CH4, HFC, PFC, SF6. HFC and PFC make up of many sub-substances.Show Substance:Identify which substance to display (if a selection was made).Convert to CO2:Convert each substance to co2. In my Substances table I have a gwp field which is the multiplier to convert to co2. HFC and PFCI need to add all sub-substances to get PFC and then HFC. There is a field in the Substances table that holds the category in which a pollutant is (pfc, hfc, total).Calculate row total:calculate the total of a row of substance (n2o + co2 + pfc...)Calculate grand total:calculate the total of a column (co2 + co2...)I got most of this done. The way I did it was with a dev array which is a 3 dimension array that holds the substance name, gwp multiplier, raw data, data converted to co2, show sub (true/false). I then create a 2d array that mirrors an excel table. All I need to do at this point is calculate the row and grand total and then display. I got all this done but the load time is pretty high. When attempting to load 350 rows it hangs there for way too long. Less than 20 rows is fine. To display the data I create about 8 arrays, use a cfcomponent, use about 10 functions., many loops.I'm sure there is a better way of building this. I built this system using object oriented programming.Would using a structure instead of 8 array help or maybe 1 huge array? Link to comment Share on other sites More sharing options...
This topic is now archived and is closed to further replies.