Expand my Community achievements bar.

Creating a Poll Pod

Avatar

Former Community Member

Hi,

I want to create a custom pod which will enable owners to create questions (with answer options for others to choose from ofcourse), and others to submit their votes. I went through the SharedModel sample to see how can I work with shared model. I'm having difficulty on deciding how should I set up my Collection Node.

Could you give me some ideas, like, how would you create your nodes and what would their types be?

For example, I think I'll need a "questionLabels" node. Which will have Manual Storage Scheme and have 1-level object with question strings and IDs. But, for example, how should I store answers and create the relationship between them and questions? Some advice would be very good.

Thanks in advance.

Edit:

I found this: http://forums.adobe.com/message/2392460#2392460 But it seems outdated. Is there already a pod like what I've described?

3 Replies

Avatar

Employee

Hi,

Have you explored the SharedObject API ?, you can assoicate a key with each new question, and the poll count as its value.

Thanks

Arun

Avatar

Former Community Member

Hi Arun,

Thank you very much. I have looked into the SharedModel and some of the SharedObject APIs. But my main starting point on figuring out what could I do was the Room Manager's Explore tab. But now I see that SharedObject has a better perspective for a programmer.

SharedObject.setProperty() takes a value parameter of Object. So I can store Array in a property. Does this mean I could (or should, in this particular example) store all my questions in a property, all the options in another property and all the votes submitted in another one? Then whenever I need to count how much votes had been submitted for a particular option, I could just walk through the votes Array (property.value) and increase the counter according to the question?

Avatar

Employee

You could do that, but a better approach would be a new shared object for each new question, and the options and poll count would be the key value pairs of the sharedObject question.

Thanks

Arun

PS: Dont forget to delete sharedObject that you might not need.