Skip to main content
Known Participant
March 25, 2008
Question

Form Builder storing results as WDDX

  • March 25, 2008
  • 11 replies
  • 1693 views
A while back i wrote a form builder. To store the results of a form submission I decided to use wddx and save the xml string into the db, which seemed like a good idea at the time. Further down the line this form builder has been used for much larger forms and sheer amount of data being store as text is making the server crash when it has to be serialized or deserialized.
I was wondering if there is a better way to store this data, obviously storing the data in tables would be a bit of a pain as the form builder is dynamic and can have any number of fields.
I decided against storing the wddx data in a text file as i was worried about read/write locks on a busy form. Was i wrong to go down this route?

Hope someone can help

Matt
This topic has been closed for replies.

11 replies

cf_mattAuthor
Known Participant
March 27, 2008
I'm going to re-write it to create tables. I think the individual records as wddx packets could still be a problem. Mainly because forms can be edited after results have been collected which would mean the field list in each result could change. I can think of ways round this but It could still potentially be a lot of reworking.

Thanks Ian
Inspiring
March 26, 2008
cf_matt wrote:
> Hmm i hadnt thought about breaking each record into a wddx packet, it would
> make it hard on cf to display a list of results though as you would have to
> parse each packet for a value.

You more or less have to do that now. You have to parse each record
node of the larger WDDX packet. I don't think it would be that large a
change to parse a group of WDDX packets for the list.

> I am starting to think that if i'm going to do the whole thing with name and
> value pairs then i would rather re-write the whole thing to create individual
> tables.

My instinct says this is probably a more robust and scalable solution.
cf_mattAuthor
Known Participant
March 26, 2008
Hmm i hadnt thought about breaking each record into a wddx packet, it would make it hard on cf to display a list of results though as you would have to parse each packet for a value.

I know what you mean about huge amounts of records not really being a problem.

The scenario I have is that clients are using the form builder for employment forms, so the forms have about 100 fields (i'm not joking). so that would be 100 records per individual entry.

I guess it will still be faster than using wddx.

I am starting to think that if i'm going to do the whole thing with name and value pairs then i would rather re-write the whole thing to create individual tables.



Inspiring
March 26, 2008
cf_matt wrote:
> Ian
>
> yes i think thats right
>
> so i have:
>
> form_id | form_name | form_recordset
> 1 enquiries <WDDX>
>
> I did think about storing name and value pairs in a table but then that would
> be huge amounts of records
>


First of all, don't be afraid of a huge amount of records. That is what
databases are designed to deal with. A great many very smart people
have spend a great many hours making database management systems very
efficient at processing huge amounts of records for the past fifty years
or so. Personally, I trust their work to be more complete then anything
I can cobble together on my own.

Secondly, I would at least break it up so that each complete form submit
is one record in the database. Then at least you are dealing with a
constant sized WDDX packet, not one that is growing with every new
record append to the data.



cf_mattAuthor
Known Participant
March 26, 2008
Ian

yes i think thats right

so i have:

form_id | form_name | form_recordset
1 enquiries <WDDX>

I did think about storing name and value pairs in a table but then that would be huge amounts of records
Participating Frequently
March 26, 2008
Why don't you save form results direct to the database? Do you really need WDDX?

OR you can try to use JSON or direct XML.
cf_mattAuthor
Known Participant
March 26, 2008
I opted for using wddx because the results were dynamic. A form could have many fields and i would need to use create table SQL statement and I would also need to create relationship tables for form fields that could have multiple options.
This is the route i'm trying to avoid, but it looks like its inevitable.
A different XML format other than WDDX would probably half the size of the data i'm storing so i guess that might be an option.
Is there a wddx to db solution? that would be rather cool!
Participating Frequently
March 26, 2008
You can check the page politico.com as an example.

This site uses ColdFusion but you can not figure out easily.

Because of having huge load on servers, they prefer to generate news page as HTML from database and save as static pages. That does not means that these pages are not dynamic. They are but just not generated on fly.

This allows less load because of not generating all the pages in realtime. The admin just push a button and generate all the pages 4 times a day etc. I think your forms are not changing everyday and you may consider to generate these dynamic forms daily or on demand basis and use them in your application without having the load to generate them dynamically in every request.
cf_mattAuthor
Known Participant
March 26, 2008
Oguz
but the problem occurs when the form is submitted i dont have any problems generating the code for the forms.
The process is as follows:

- coldfusion dynamically generates form (no speed issues)
- user submits form
- data submitted gets entered into database as wddx <----bottleneck server hangs for a while serializing and deserializing
- Administrator logs into admin to look at results < -- more serialization / deserialization - server is hanging
cf_mattAuthor
Known Participant
March 26, 2008
Also if i stored the results as html, i wouldnt be able to ever change the output or easily show the output, it sounds messy.
the data is queried also (i convert the wddx to cfquery). I know its very hard to know without seeing the code but this wddx packet is definately the bottleneck and if there was an alternative or faster way of storing the information or dealing with this information then that would really help.
I've started to give the option to archive the information but on a form that has say 50 fields it doesnt take long for the wddx results to get huge!

I didnt originally design the form builder for forms of this size but it is being used this way and is so much faster than developing the forms with cfml.
Participating Frequently
March 25, 2008
You can save these forms in HTML format and include them whenever you need them.

How you generate ehse forms is also very basic logic. After deciding latest form status in your admin, you can push these latest forms as HTML into a directory etc. with a "Generate Forms" button. This only works once on admin interface and you do not have to do this work in realtime for every request.

I hope it is clear. :)

cf_mattAuthor
Known Participant
March 26, 2008
Hmm, i'm still a bit puzzled, the actual form itself isnt too bad processing-wise its dealing with the data posted from the form and storing the results, the results needs to be exportable to csv so storing them as html woulnt really work.
At the moment when the form is posted it goes to a cfcase and appends a row to the wddx packet, the problem is this packet is huge and when i deserialize or serialize it, the server hangs for quite a while dealing with the amount of data.
You have to remember the forms are dynamic so the results are dynamic also.
Participating Frequently
March 25, 2008
I had a same kind of issue and at the end I decided to generate forms in static HTML via admin. Whenever they finished editing forms I generated HTML for the forms with a "generate" button and saved the generated forms in a directory and embedded (included) these forms in the application pages with a simple parameters.