Function Repository Resource:

WebPoll

Source Notebook

Create simple web polls

Contributed by: Bob Sandheinrich

ResourceFunction["WebPoll"][name]

generates a web poll and gives an object for managing the poll.

ResourceFunction["WebPoll"][name,question]

specifies an initial question for the poll.

Details

The result is a ResourceFunction["WebPoll"] object.
ResourceFunction["WebPoll"][][operation,] is used to perform operations using the WebPoll object. The following operations are supported:
"Form"cloud object containing the form
"Update",questionask the specified question
"Data"snapshot of the latest polling data
"DynamicResults"dynamic panel showing results as they are created
"Name"the name of the poll
"Close"close the poll
"ID"unique ID for the web poll
"QR"QR code linking to the web form
ResourceFunction["WebPoll"] is implemented using ChannelObject and CloudObject, and requires a cloud connection.
Users authenticated with the Wolfram Cloud will be referenced using their Wolfram IDs. Unauthenticated users will be assigned an "Anonymous" ID based on their IP address.
The "ID" is a URL-safe version of the name generated by ResourceFunction["SlugifyString"].
ResourceFunction["WebPoll"][] will assign a UUID as a name.

Examples

Basic Examples (2) 

Create a simple web poll:

In[1]:=
ResourceFunction["WebPoll"]["Straw Poll"]
Out[1]=

Start a new polls with a question:

In[2]:=
ResourceFunction[
 "WebPoll"]["Baseball", "Who will lead the National League in home runs next year?"]
Out[2]=

Scope (8) 

Create a poll for questions about music:

In[3]:=
poll = ResourceFunction["WebPoll"]["Music"]
Out[3]=

Prepare a dynamic display for poll results when they are added:

In[4]:=
poll["DynamicResults"]
Out[4]=

Ask the first question:

In[5]:=
poll["Update", "What is your favorite dance song?"]
Out[5]=

Open the form to answer the question yourself:

In[6]:=
poll["Form"] // SystemOpen

Get a QR code to distributed your poll:

In[7]:=
poll["QR"]
Out[7]=

Ask a new question:

In[8]:=
poll["Update", "Are you listening to music right now?"]
Out[8]=

Get the data:

In[9]:=
data = poll["Data"]
Out[9]=
In[10]:=
Grid[Take[
  PadLeft[Flatten[{#}], 3, ""] & /@ List @@@ Normal@DeleteMissing[Lookup[#, "Content"] & /@ data], UpTo[200]], Dividers -> {All, False}, Alignment -> Left
 ]
Out[10]=

Closing the poll will remove open channel connections:

In[11]:=
poll["Close"]

Version History

  • 1.0.1 – 26 May 2023
  • 1.0.0 – 14 August 2019

Related Resources

License Information