theThought's thoughts

Kevin A Gray - Creative Strategy Guy

Building the core components - Data Collection Populates an OpenXML form using Custom Parts (The Survey)

There are three core components that have to built to simulate and then develop the process of using PASW Data Collection to populate an OpenXML document using custom parts:

·         The Survey

·         The Custom Part

·         The Word Template

This post (and the following two) will explain each of these components provide the script that was used and explain (where relevant) where outside agencies were used to gain an understanding of how the process should be created.

The Survey
As stated in the previous post (project definition) a two page survey is required that captures the details of the individual and the details of the complaint.  This can either be constructed in Author or Author Professional, however Author Professional was used in this case.  As can be seen by the metadata definition below, not only were the questions themselves defined but also the overall look and feel of each question.  The setting of a lablestyle width and the positioning of the control (to the right of the label) has been achieved within the metadata to create a more form like appearance.  This means that the routing is kept very simple (selection of layout template and the asking of the two page questions).

Metadata

Metadata(en-GB, Question, Label)

      TitleList "" define
            {
                  Mr "
Mr",
                  Mrs "
Mrs",
                  Ms "
Ms",
                  Dr "
Dr"
            } asc;
      SeverityList "" define
      {
            Mild "
Mild",
            Annoying "
Annoying",
            Concerning "
Concerning",
            Upsetting "
Upsetting",
            Severe "
Severe"
      };

      title "Title"
            style(ElementAlign = "
Right",
                  Control(Type = "
DropList"))
            labelstyle(Width = "
70px")
            templates(Question = "
SameLineQuestion.htm")
      categorical [1..1]
      {
            use TitleList –

      };
      fname "
First Name:"
            style(ElementAlign = "
Right", Width = "300px", Height = "17px",
                  Control(Type = "
SingleLineEdit"))
            labelstyle(Width = "
70px")
            templates(Question = "
SameLineQuestion.htm")
      text [..50];

      lname "Last Name:"
            style(ElementAlign = "
Right", Width = "300px", Height = "17px",
                  Control(Type = "
SingleLineEdit"))
            labelstyle(Width = "
70px")
            templates(Question = "
SameLineQuestion.htm")
      text [..50];

      Address1 "Address:"
            style(ElementAlign = "
Right", Width = "300px", Height = "17px",
                  Control(Type = "
SingleLineEdit"))
            labelstyle(Width = "
70px")
            templates(Question = "
SameLineQuestion.htm")
      text [..100];

      Address2 " "
            style(ElementAlign = "
Right", Width = "300px", Height = "17px",
                  Control(Type = "
SingleLineEdit"))
            labelstyle(Width = "
70px")
            templates(Question = "
SameLineQuestion.htm")
      text [..100];

      Town "Town:"
            style(ElementAlign = "
Right", Width = "200px", Height = "17px",
                  Control(Type = "
SingleLineEdit"))
            labelstyle(Width = "
70px")
            templates(Question = "
SameLineQuestion.htm")
      text [..100];

      PostCode "Postcode:"
            style(ElementAlign = "
Right", Width = "100px", Height = "17px",
                  Control(Type = "
SingleLineEdit"))
            labelstyle(Width = "
70px")
            templates(Question = "
SameLineQuestion.htm")
      text [..10];

      eMail "e-Mail:"
            style(ElementAlign = "
Right", Width = "300px", Height = "17px",
                  Control(Type = "
SingleLineEdit"))
            labelstyle(Width = "
70px")
            templates(Question = "
SameLineQuestion.htm")
      text [..100];

      Phone "Phone (Home)"
            style(ElementAlign = "
Right", Width = "150px", Height = "17px",
                  Control(Type = "
SingleLineEdit"))
            labelstyle(Width = "
70px")
            templates(Question = "
SameLineQuestion.htm")
      text [..20];

      Mobile "Mobile"
            style(ElementAlign = "
Right", Width = "150px", Height = "17px",
                  Control(Type = "
SingleLineEdit"))
            labelstyle(Width = "
70px")
            templates(Question = "
SameLineQuestion.htm")
      text [..20];

      Phone2 "Phone (Work)"
            style(ElementAlign = "
Right", Width = "150px", Height = "17px",
                  Control(Type = "
SingleLineEdit"))
            labelstyle(Width = "
70px")
            templates(Question = "
SameLineQuestion.htm")
      text [..20];

      IncidentDate "Date:"
            style(ElementAlign = "
Right", Width = "150px", Height = "17px",
                  Control(Type = "
SingleLineEdit"))
            labelstyle(Width = "
70px")
            templates(Question = "
SameLineQuestion.htm")
      date;

      IncidentDestination "Destination"
            style(ElementAlign = "
Right", Width = "200px", Height = "17px",
                  Control(Type = "
SingleLineEdit"))
            labelstyle(Width = "
70px")
            templates(Question = "
SameLineQuestion.htm")
      text [..50];

      IncidentDepart "Depart From:"
            style(ElementAlign = "
Right", Width = "300px", Height = "17px",
                  Control(Type = "
SingleLineEdit"))
            labelstyle(Width = "
70px")
            templates(Question = "
SameLineQuestion.htm")
      text [..50];

      IncidentExpected "Depart Time (Expected)"
            style(ElementAlign = "
Right", Width = "100px", Height = "17px",
                  Control(Type = "
SingleLineEdit"))
            labelstyle(Width = "
70px")
            templates(Question = "
SameLineQuestion.htm")
      text [..10];

      IncidentActual "Depart Time (Actual)"
            style(ElementAlign = "
Right", Width = "100px", Height = "17px",
                  Control(Type = "
SingleLineEdit"))
            labelstyle(Width = "
70px")
            templates(Question = "
SameLineQuestion.htm")
      text [..10];

      IncidentSeverity "Severity"
            style(ElementAlign = "
Right", Height = "17px",
                  Control(Type = "
DropList"))
            labelstyle(Width = "
70px")
            templates(Question = "
SameLineQuestion.htm")
            categorical [1..1]
            {
                  use SeverityList -
            };

      IncidentDescription "Description"
            style(Width = "
500px", Height = "68px",
                  Control(Type = "
SingleLineEdit"))
            labelstyle(Width = "
70px")
      text [..1000];

      ExpectedOutcome "Expected Outcome"
            style(ElementAlign = "
Right", Width = "300px", Height = "17px",
                  Control(Type = "
SingleLineEdit"))
            labelstyle(Width = "
70px")
            templates(Question = "
SameLineQuestion.htm")
      text [..200];

      CostIncurred "Cost Incurred (£)"
            style(ElementAlign = "
Right", Width = "100px", Height = "17px",
                  Control(Type = "
SingleLineEdit"))
            labelstyle(Width = "
70px")
            templates(Question = "
SameLineQuestion.htm")
      long;

      Personal -
      page(title, fname, lname, Address1, Address2, Town, PostCode, eMail, Phone, Mobile, Phone2);

      Incident -
      page(IncidentDate, IncidentDestination, IncidentDepart,     IncidentExpected, IncidentActual, IncidentSeverity, ExpectedOutcome, CostIncurred, IncidentDescription);
End Metadata

Routing

Routing(Web)

      IOM.LayoutTemplate = "RailComplaint.htm"

      Personal.Ask()

      Incident.Ask()

End Routing

 

For those of you with PASW Data Collection ver sion 6 or later.   The metadata and routing are located in the attached mdd.  If you would like to know more about the metadata and routing contained in this post, please download the DDL (a technical manual on Data Collection) from Data Collection Document Library.

 

Click here to download:
Complaint.mdd (279 KB)

 

Filed under  //   Custom Part   Dimensions   Metadata   Microsoft Word   OpenXML   PASW DATA Collection   Routing   SPSS  

OpenXML / PASW Data Collection - Project 1

My presentation at SPSS Directions in Las Vegas (9th – 13th Nov) will require me to provide several working examples of OpenXML / PASW Data Collection integration.  I am currently looking for three different examples with increasing levels of complexity.  Two will probably be around the survey metadata document and Word while the third will be around a reporting script that is exporting to PowerPoint.

So in order to not overwhelm the project and suffer from the inevitable procrastination I have decided to start with a topic that is often requested by clients.

Is it possible to create a printable copy of the responses to a survey so that it can be sent either to the respondent or a stake-holder?

Scenario:
A Rail company wishes to provide an online complaints form that allows travellers to submit details of complaints regarding late trains or poor service while on trains.  The information would then be escalated to the relevant account manager with the complainant receiving a copy of the details of the complaint for their own records.

The Survey:
This will consist of two pages of questions.  The first will obtain general details of the complainant while the second will obtain details of the complaint.  Once both pages have been captured the complainant will be asked to confirm submission and then will be e-Mailed a PDF copy of the complaint.  Their e-Mail address is a mandatory field in the first page.

The Steps:
The following steps will be required to complete the project:

·         Construct Survey Metadata

·         Construct Survey Routing to ask questions

·         Watch Microsoft Videos on Custom Parts

·         Build Routing to construct an XML document of the responses provided

·         Construct a Word document defining the layout of the complaint record form

·         Pass the XML across to the document as a Custom Part

·         Insert Placeholders into the document to ensure the information appears in the right locations in the document

·         Create a dll that receives the XML from PASW Data Collection, inserts it into the custom part within the document template, generates a PDF from the resulting document and sends it to the complainant

These steps have been defined before I have had chance to watch the videos on the implementation of custom parts.  I am documenting my intentions at this point so that I can show what has to change once I better understand the way custom parts work.

Filed under  //   Custom Part   Metadata   OpenXML   OpenXML SDK 2.0   PASW DATA Collection   Routing   SPSS   SPSS Directions