Creating a Bulk Editing Dashboard for Office 365 - Don Stephen Lambatin
in

InfoPath Dev

Don Stephen Lambatin

Creating a Bulk Editing Dashboard for Office 365

A business intelligence dashboard is a data visualization tool that displays the current status of metrics and key performance indicators for a business, department, or specific process at a quick glance. Using InfoPath as a Dashboard gives us more control or customizability over the design, layout, filters, and may even perform complex type of queries.

Since InfoPath forms provides us with such customizability, why not push the limit further by adding a bulk editing feature to your InfoPath Dashboard.

 

Bulk Edit Dashboard Requirements

This guide assumes we are working on a SharePoint Online environment with Office 365 and requires the following elements:

The Bulk Edit Dashboard also works for SharePoint 2016 or lower, where Code-Based Sandbox is enabled – FormsViewer is not required and can be optional.

The Target Library (Optional)

This section is optional if you already have a target library which you intend to query for your Bulk Editing Dashboard tool, but for instructional purposes, a re-usable Form Template Library (STP) file is provided for Office 365.

Deploy the site template (STP) file.

  1. Download the STP file here.
  2. Go to the Site Settings (make sure you are on the top level site settings)
  3. Under Web Designer Galleries, click List templates.
  4. Upload the Invoice_Request_Library STP file.
    • Click Upload Document under Files tab
    • Browse for downloaded STP file and click OK

 

Refer to the link below for a more detailed steps on the web on how to upload an STP template

https://support.office.com/en-us/article/Manage-list-templates-c3884ad1-bc49-44b8-b3d6-3bc6a01eb393

Create the Library using the STP file 

  • Proceed to the target site/subsite.
  • Go to Site Contents
  • Add an app.
  • Search for the Invoice_Request_Library STP file.
  • Click the App to create the library.
  • Enter a library name such as Invoice_Request_Library

When done, proceed to the library and check out the contents:

 

We will be performing a bulk edit operation on the items above at the end of this guide.  

  • At the Library tab, create a new column called select.

  • Leave the rest of the configuration as is and click OK.
  • Repeat the same procedure for creating two more columns called submit and success.

The 3 newly added columns will be used later on for the Dashboard’s Bulk Edit logic.

When done, you may choose to submit new items by clicking on the New button. 

FormsViewer 

This guide assumes that you already have FormsViewer installed on your SharePoint O365 Environment. Kindly skip this section if you already have the FormsViewer app installed.

If you plan to create this Bulk Edit Dashboard on SharePoint 2016 or lower without FormsViewer, be sure to have Sandbox enabled in order for qRules to run.

To install FormsViewer, download the App along with the guide from the link provided below:

http://www.infopathdev.com/files/folders/formsviewer_v11/entry104513.aspx

Creating the Dashboard

In order to fully understand the fundamental elements of the Bulk Edit Dashboard, you will be creating the dashboard from scratch.

Before we proceed, here’s a list of data connections needed:

  • Retrieve library data connection to query target library – for displaying items intended for bulk editing
  • Retrieve XML document data connection – for retrieving the XML document to be updated
  • Submit to Library – for submitting retrieved document along with modified content/s

Steps:

  1. Open a Blank InfoPath Designer form.
  2. Under the Data Tab, click Data Connections and Add a data connection which receives data from the target SharePoint library, in this case the Invoice_Reques_Library created earlier.
  3. At the next page, select the following columns from the SharePoint library:

         

  1. Click Next twice until you reach the last page of the data connection wizard.
  2. At the last page, untick the Automatically retrieve data checkbox and click Finish to exit the wizard.

Disabling the Automatically retrieve checkbox is optional but highly recommended since it enables you to filter out unwanted data on your on load query by specifying a filter at the data connection’s query fields before triggering the query action – As far as performance is concerned, we would not want to return all the data  when the form loads.

  1. Add another data connection which receives data from an XML document.

         

  1. Click Next.
  2. Enter the URL to the library.
  3. After the URL, add a slash and enter an existing File Name (XML) from the library and add the prefix .xml.

https://qdabra.sharepoint.com/Website/Invoice_Request_Library/don.lambatin_20170303142035.xml

Open up the link in the browser to verify if you have the correct link to your form. Be sure you got the File Name correct otherwise an error will appear if you do not have a correct link and it will not properly open up the form in the browser.

  1. Click Next.
  2. At the next page, select Access to the data from the specified location.
  3. Click Next.
  4. Provide a meaningful data connection name such as GET_Invoice_XML.
  5. Click finish.

         

Notice that you now have a new secondary data connection source with fields matching the columns from the target library.

  1. Add a submit data connection that submits data to the target SharePoint Library:

         

Be sure to specify the correct link to the library.

  1. Tick the Allow overwrite checkbox – IMPORTANT!
  2. For the File Name, click the fx
  3. Click Insert Field or Group.
  4. Select the FormName field from the GET XML data connection:

         

Note that this field should match the target library’s XSN template’s selected File Name field declared at the Submit to SharePoint Library data connection wizard.

  1. Click Next.
  2. Leave the name as is and click Finish.

Your list of data connections should look similar to this:

            

  1. Save the form and inject with qRules.
    • Go to File tab > Save As > select desired save location.
    • Close form
    • Launch the Qdabra Rules Injector tool by clicking on Start > Programs > Qdabra > Tools > qRules > qRules Injector.
    • Specify the template by browsing for the Dashboard XSN saved.
    • Click Inject!

          

  1. Re-open the injected form (right click on the XSN and select design).
  2. Design your layout – Header and Footer
  3. At the Invoice_Request_Library secondary data connection, layout your repeating table onto the canvas. – Right click on the repeating section, drag it onto the canvas, and select Repeating Table
  4. Select columns you would like to display.
  5. Replace all text boxes with a Calculated Field Box (Right click on the field > Change Control > select Calculated Value).
  6. At the left most section of the table, insert a narrow column for the select check box
  7. Change the select text field control to a checkbox (right click > properties > change control > select check box).
  8. At the header of the select check box column, add a button.
  9. Under the Home tab click on Manage Rules.
  10. Add a rule that sets the value of the select field to the value Name this rule Select All.

          

  1. At the left most section of the table, insert a column for the success
  2. Click on the success field and change this control to a calculated field.
  3. Still at the success field, Add two formatting rules:
    1. Set the name of the first formatting rule to Green if success
    2. Add a condition where success is equal to the word “success”
      • For the first and second dropdown, leave the two selections as is
      • For the third dropdown, select Type text and manually enter the word “success” without the double quotes
      • At the Formatting section, change the shading to Green and set the text font to Bold.

      Your formatting rule should look similar to this:

               

    3. Perform the same steps for the second formatting rule where:
      • Rule name: Red if failed
      • Condition: success is equal to “false”
      • Set shading to Red, text font to White and set it to Bold.

This field will later on display the result of the SubmitToSharePoint qRules command

  1. At the Main Data Source, change the section’s name myFields to a more meaningful name such as Dashboard.
  2. Add a new section named FormLogic.
  3. Inside this section, add the fields below and follow the corresponding data type:

          

Your schema should look similar to this:

          

  1. Insert a 2 x 1 Custom Table right above the repeating table – this section will hold the buttons and dropdown control for the bulk edit Status selection.
  2. Inside the right section of the custom table, display Status field from the FormLogic section as a dropdown.
  3. Right click on the dropdown control, select properties, and manually enter the following choices:

          

  1. Beside the dropdown control, add a button and rename the button label to Update.
  2. Add an action rule named Update.
    • On this rule, Add an action that sets a field’s value.
    • Set the target field to the submit field of the Invoice_Request_Library data connection.

              

    • Set this field to the value “1” without the double quotes.
  3. Add a new rule to set the Status field of the FormLogic section to a blank value – we would like to reset the dropdown field after the bulk edit operation has succeeded.
  4. Add a formatting rule that disable the Update button if the value of the Status field is blank – this will prevent users from clicking the Update button if there is no new Status selected.
  5. At the Left section of the Custom table, add a new button and re-name the button label to Refresh.
  6. At the Refresh button, add an action rule that queries the Invoice_Request_Library data connection.

We are now down to the last major component of this guide which will use the following qRules commands:

  • ChangeConnectionUrl

    • This command will update the XML location specified at the Get_Invoice_XML data connection created earlier, to the corresponding FileName selected from the displayed items at the Invoice_Request_Library repeating table.

  • InsertPi

    • This command is used to manipulate the InfoPath form’s Processing Instructions
    • Since we are only getting the XML content from the Get_Invoice_XML data connection, we will insert Processing Instructions that will conform to the target Library’s requirements in order for the forms to open up properly in the browser.

  • SubmitToSharePoint

    • This is a bit self-explanatory – this command will be used for submitting the each row separately as XMLs to the target Invoice_Request_Library.

 

  1. At the submit node of the Invoice_Request_Library, add the following rules:
  • Stop if not 1 and not selected
    • Rule name: Stop if not 1
    • Condition: submit is not equal to “1”
      • Click the condition link and leave the first dropdown as is
      • Change the second dropdown to not equals to
      • Select Type text for the third dropdown and manually enter the value 1
      • Click the And button beside the third dropdown to add a new condition below, and replace this with an OR
      • Set the first dropdown to the select node.
      • Change the second dropdown to not equals to
      • Select Type text for the third dropdown and manually enter the value yes
    • Action target field: stop attribute field of the FormLogic section located at the main data source.
    • Value: none (blank)
    • Tick the checkbox to stop all other actions if the condition is met.

Your rule should look similar to this:

                                  

The objective of this rule to prevent other rules if the submit action is not triggered and if the current row is not selected. 

  • Reset self
    • Rule name: Reset self
    • Condition: none
    • Action target field: submit (self)
    • Value: none (blank)
  • ChangeConnectionUrl and query XML
    • Rule name: ChangeConnectionUrl and query XML
    • Condition: none (blank)
    • Action target field: Command node of qRules located at the QdabraRules data source.
    • Value: click the fx button to insert the formula:

    concat("ChangeConnectionUrl /dsname=GET_Invoice_XML /url=https://qdabra.sharepoint.com/Website/Invoice_Request_Library/", Title)

    • Highlight Title and select the Title field from the Invoice_Request_Library


In this formula we are calling the qRules command ChangeConnectionUrl which will update the XML location specified for the GET XML query.

The parameter dsname identifies which data connection will be updated. For this guide we have used the GET XML data connection named GET_Invoice_XML.

The parameter url should point to the location of the XML in SharePoint. Since the target library is the Invoice_Request_Library, we will use the link to that library and concatenate that url to the Title field which contains the File Name (or FormName) that was specified in step 19.

Concatenating the syntax to the Title field allows us to filter out the query data connection dynamically – each row will have a different URL.

The result of this formula should be similar to the URL specified in step 9.

    • Add a data connection to query the Get_Invoice_XML data connection

Your rule should look similar to this:

                                 

  • Update current Status
    • Rule name: Update current Status
    • Condition: none
    • Action target field: Status field of the Get_Invoice_XML data connection
    • Value: Status field of the FormLogic section from the Main data source

Your rule should look similar to this:

                                  

Before proceeding to the next rule, we must first understand what the parts of the Processing Instructions are.

Download a sample XML from the Invoice_Request_Library and open the file using a text editor such as notepad. Here’s how the first Processing instruction should look like:

<?mso-infoPathSolution solutionVersion="1.0.0.33" productVersion="16.0.0" PIVersion="1.0.0.0" href="https://qdabra.sharepoint.com/Website/Invoice_Request_Library_TEST/Forms/template.xsn" name="urn:schemas-microsoft-com:office:infopath:Invoice-Request-Library-TEST:-myXSD-2017-02-15T12-49-08"?>

In the sample above, we have the Processing Instruction name located at the beginning of the string: mso-infoPathSolution. The succeeding data are the contents for this particular Processing Instruction.

Let’s build the InsertPi command.

InsertPi /name=mso-infoPathSolution /data=solutionVersion="1.0.0.33" productVersion="16.0.0" PIVersion="1.0.0.0" href="https://qdabra.sharepoint.com/Website/Invoice_Request_Library_TEST/Forms/template.xsn" name="urn:schemas-microsoft-com:office:infopath:Invoice-Request-Library-TEST:-myXSD-2017-02-15T12-49-08 /dsname=GET_Invoice_XML /update=true

Here we have declared the name of the Processing Instruction along with the data content. We have also declared the parameter dsname so that qRules identifies where we would like to add the processing instructions to, and that we are updating the data that is already existing.

For the first action for this command, we will

  • Insert PI
    • Rule name: Insert PI
    • Condition: none
    • First Action:
      • Target field: Command node of qRules
      • Value:

InsertPi /name=mso-infoPathSolution /data=solutionVersion="1.0.0.33" productVersion="16.0.0" PIVersion="1.0.0.0" href="https://qdabra.sharepoint.com/Website/Invoice_Request_Library_TEST/Forms/template.xsn" name="urn:schemas-microsoft-com:office:infopath:Invoice-Request-Library-TEST:-myXSD-2017-02-15T12-49-08 /dsname=GET_Invoice_XML /update=tr

Note that this is a hardcoded value and not a formula

  • Second Action:
    • Target field: Command node of qRules
    • Value:

InsertPi /name=mso-application /data=progid="InfoPath.Document" versionProgid="InfoPath.Document.4" /dsname=GET_Invoice_XML /update=true

  • Submit
    • Rule name: Submit
    • Condition: none
    • Action target field: Command node of qRules
    • Value:

SubmitToSharePoint /dssubmit=SharePoint Library Submit /dsname=GET_Invoice_XML

 

In this command, we are using the SharePoint Library Submit data connection for the submit operation, and we declared that the GET_Invoice_XML is the data source that which will be submitted.

 

  • Set Success
    • Rule name: Set Success
    • Condition:
      • Click the condition link and set the first dropdown to the Result node of of qRules
      • Leave the second dropdown to equals to
      • Select TRUE for the third dropdown
    • First Action
      • Target field: success node of the current data connection
      • Value: Type in the word “success” without the double quotes
    • Second Action
      • Target field: Status node of the current data connection
      • Value: Status field of the FormLogic section from the Main data source

Your action should look similar to this:

                                     

  • Set Failed
    • Rule name: Set Failed
    • Condition:
      • Click the condition link and set the first dropdown to the Result node of of qRules
      • Leave the second dropdown to equals to
      • Select FALSE for the third dropdown
    • Action target field: success node of the current data connection
    • Value: Type in the word “failed” without the double quotes

 When done, upload your form to FormsViewer.

 At the FormsViewer site, click on Upload a New Template.

Provide a meaningful name, drag the XSN template, and click on the Upload button.

 

 

 When done, click Open Form to view and test your Dashboard:

 

 

Published Mar 17 2017, 09:32 PM by donstephen
Filed under:

Comments

No Comments
Copyright © 2003-2017 Qdabra Software. All rights reserved.
View our Terms of Use.