Mel Balsamo
in

InfoPath Dev

This Blog

Syndication

Mel Balsamo

  • Free Training: Data-Driven Design - Using XML Files to Configure Other Forms (Lab 2)

    In this lab, your business process has evolved and you have many more questions and answers. You decide using a configuration form is more efficient so you'll modify your Quiz Form from Lab 1. In real life, you could also create a form that pulls from a configuration form without going through the steps in Lab 1.

    Create a Form out of your Template

    1.       Open your Quiz Form template in InfoPath Designer.

    To make sure you are not overwriting your template for Lab 1, change the title and save it with a different name.

    2.       Preview your form template, go to File > Save As and save it as Config.xml. This will save the schema as well as the default data in an XML format.

    3.       Close Preview.

    Add a Data Connection to the XML File

    We are going to add our new configuration XML as a resource to our template.

    4.       Go to the Data tab > Data Connections, and then click Add.

    5.       Add a data connection that receives data from an XML document.

    6.       Browse to the Config.xml file saved earlier.

    7.       Click Next twice leaving the default selections, click Finish and then click Close.

    Change the Drop-Down to get Choices from the Secondary Data Source

    8.       Modify the data source for the SelectedModule drop-down list box to use the default Modules in the new Config data source:

    a.   Right-click on the SelectedModule drop-down and select Drop-Down List Box Properties.

    b.   Change List box choices to Get choices from an external data source. The Data source will default to the Config data connection you created earlier:

    c.   Click on the icon next to Entries, select the Module repeating group under Modules and then click OK.

    d.   Leave Value set to my:ModuleNo, but change Display name to my:ModuleName, and then click OK.

    Use InfoPath Functions to Get Row Numbers

    In this section, we will use the built-in InfoPath functions count and preceding-sibling to create row counts for the Module and the Question repeating groups. We will use these row counts as default values to the ModuleNo and the QuestionNo fields. We will then use a formula to auto-increment the fields as we add new rows to the repeating groups.

    9.       Set the default value of the ModuleNo field.

    a.   In the Fields taskpane, double-click on the ModuleNo field to display its properties.

    b.   Under Default Value, click on the fx button next to the Value box.

    c.   Enter the formula: count(../preceding-sibling::my:Module) + 1

    d.   Click Verify Formula and you'll see this:

    e.   Click OK twice.

    10.    Set the default value of the QuestionNo field.

    a.   In the Fields taskpane, double-click on the QuestionNo field to display its properties.

    b.   Under Default Value, click on the fx button next to the Value box.

    c.   Enter the formula: count(../preceding-sibling::my:Question) + 1

    Change the Default Values to Pull Data from the Secondary Data Source

    In the Fields taskpane, if you double-click on the ModuleName field of the main data source to see its properties, you will see the the default value you've manually added from Lab 1. We will change this value to pull from the configuration file instead.

    11.    Click on the fx button and then click Insert Field or Group...

    12.    Switch to the Config (Secondary) data source and follow the series of steps shown in the image below to select and filter the ModuleName field.

    13.    Click OK four times.

    If you check the Edit XPath (advanced) box, you'll see the XPath xdXDocument:GetDOM("Config")/my:QuizForm/my:Modules/my:Module/my:ModuleName[../my:ModuleNo = current()/../my:ModuleNo]

    This means that the control will show the value of the Config ModuleName field  filtered so that the Config ModuleNo is the same as the main ModuleNo which is being set by the incrementing Module row count we've set earlier. Everything inside the square braces ( [ ] ) is an XPath filter. Basically, we are telling InfoPath we'd like the ModuleName from the Config and then providing further information to make sure the correct module name is selected.

    14.    Click OK twice to close the dialogs.

    Next, we will change the question texts' default values to pull from the configuration file using the same technique.

    15.    Double-click on the QuestionText field of the main data source to see its properties, you will see the the default value you've manually added from Lab 1.

    16.    Click on the fx button and change it to point to the secondary data source:

    a.   Click Insert Field or Group...

    b.   Switch to the Config (Secondary) data source and select QuestionText.

    c.   Click Filter Data... > Add.

    d.   Select QuestionNo in the first drop-down.

    e.   Choose Select a field or group... in the third drop-down.

    f.   Switch to the Main data source and select QuestionNo.

    g.   Click OK once.

    17.    We will add another filter condition in order to get only the question set for the corresponding module.

    a.   Back in the Specify Filter Conditions dialog, click on the button labeled And.

    b.   Choose Select a field or group... in the first drop-down.

    c.   Select the ModuleNo field from the Config data source and click OK.

    d.   Choose Select a field or group... in the third drop-down.

    e.   Switch to the Main data source and select ModuleNo.

    f.   Click OK four times and then check the Edit XPath (advanced) box to see the formula

    The formula used is: xdXDocument:GetDOM("Config")/my:QuizForm/my:Modules/my:Module/my:Question/my:QuestionText[../my:QuestionNo = current()/../my:QuestionNo and ../../my:ModuleNo = current()/../../my:ModuleNo]

    Here again, we are telling InfoPath we'd like the QuestionText from the Config and then added filters to make sure the correct question for the corresponding module is selected.

    Add More Default Rows

    At this point, you would want to add a couple more default rows for your repeating groups so that you'll have placeholders for new items that are added via the Config.xml.

    18.    Go to the Data tab > Default Values.

    19.     Expand Modules >  Module (last repeating group), and then select the last Question repeating node.

    20.    Click on the down-arrow key next to node, and then select Add another Question below.

    21.    Keep adding until you have about 10 repeating Question nodes. Note that if you ever exceed this, i.e. you modify Config.xml to add more than 10 questions for a module - you will need to do this step again and add placeholders.

    22.    When done, select the last Module repeating node and also add more until you have about 5.

    23.    Click OK when done.

    When you preview your form template, you will see almost no difference to the template you've created for Lab 1 - only now, we are not using default data; instead, our data is retrieved from a secondary XML data source.
  • Free Training: Data-Driven Design - Using Default Data (Lab 1)

    In this lab, you will be provided with a starter form template that has a simple pre-designed layout, the schema, and an email submit data connection so that you won't have to create them from a blank template.

    Take time to familiarize yourself with the form schema by looking at the fields in the main data source as well as how the controls are laid out on the design canvas.

    Add Default Values to the List of Modules

    Notice the Module dropdown - this lists all the modules with default values which we will configure in this lab. If you right-click on the SelectedModule dropdown list box (under the heading Select a Module) and select to show its properties, you will see that it gets choices from the Module repeating group - from within the main data source.

    In order to provide options for this dropdown, we need to add default values for the ModuleNo and ModuleName fields.

    1.       Go to the Data tab > Default Values.

    2.       Expand Modules > Module (first repeating group), select ModuleNo and then enter the default value: 1.

    3.       Select ModuleName and then enter the default value: Module 1 - Getting Started.

    4.       For the second Module repeating group, add the following default values:

    • ModuleNo: 2
    • ModuleName: Module 2 - Schemas

    You may also add default nodes manually. For this lab, we will add a third Module.

    5.       Click on the down-arrow key next to the second Module repeating node, and then select Add another Module below.

    This will add another set of Module and Questions with the last-entered values copied over by default.

    6.       Replace the default values with the following:

    • ModuleNo: 3
    • ModuleName: Module 3 - SharePoint Integration

    7.       Click OK when done.

    When you preview your form template, you should see the Module dropdown list box populate with the default values you've added:

    Add Default Values to the List of Questions

    We will also ‘hardcode' values for the QuestionNo and the QuestionText fields, hence giving them their default values.

    8.       Close Preview and then go back to the Data tab > Default Values.

    9.       Expand Modules > Module > Question.

    10.    Each module will have a list of three questions. Add the following default values for the QuestionNo and the QuestionText for each corresponding module (to save time, copy from this document and paste into the Default Value box of the respective field).

    ModuleName
    QuestionNo
    QuestionText
    Module 1
    1
    Guidance text helps users fill out forms. List three ways to add guidance text to your form.

    2
    InfoPath Designer starts with the main data source. When building a form from the ground up (blank), why is it important to identify your secondary data sources up front?

    3
    How do you uniquely name an email when you submit the form?
    Module 2 1
    What are the pros/cons of using an XML resource in the XSN vs. XML from a network share?

    2
    How do you change the default value for choice group?

    3
    How do you change default value for choice group?
    Module 3 1
    What's the difference between Save and Submit?

    2
    Why does Microsoft promote SharePoint workflows? Why are the benefits?

    3
    List 3 things that browser-based forms can't do. Why not?

    Let's also add two more default Question nodes for Module 3; but this time, there will be no default values for the questions, i.e. blank - we will conditionally hide blank questions later.

    11.    Click on the down-arrow key next to the last Question repeating node, and then select Add another Question below twice.

    12.    Delete the copied-over values in the QuestionNo and QuestionText fields for both nodes.

    13.    Click OK when done.

    Conditionally Hide Questions

    If you preview your form template at this point, you will see all the default questions you've just added. We don't actually want to show them all. Instead, we'd want to display only those questions corresponding to the selected module.

    14.    In the Fields taskpane, select the Module repeating node.

    15.    From the Home tab > Rules section, click Manage Rules to display the Rules taskpane.

    16.    Add a conditional formatting that hides questions that don't belong to the selected module.

    a.   Click New > Formatting.

    b.   Name your condition something like "Only show questions for the selected module".

    c.   Click ‘None' under Condition to display the dialog where you can add your conditions

    d.   In the Condition dialog, leave the first dropdown pointing to the ModuleNo field but change the comparison (second dropdown) to ‘is not equal to'.

    e.   On the third dropdown, choose Select a field or group..., choose the SelectedModule field of the Main data source.

    f.   Click OK twice and then check the box ‘Hide this control'.

    Your conditional formatting should look similar to this:

    We also need to conditionally hide questions that have no default values, i.e. those that are blank.

    17.       In the Fields taskpane, select the Question repeating node.

    18.       Add your conditional formatting:

    a.   In the Rules taskpane, click New > Formatting.

    b.   Name your condition something like "Hide blank questions".

    c.   Click ‘None' under Condition to display the dialog where you can add your conditions

    d.   In the Condition dialog, leave the first dropdown pointing to the QuestionNo field but change the second dropdown to ‘is blank'.

    e.   Click on the button labeled And and then change the operator to or.

    f.   Select QuestionText in the first dropdown and then change the second dropdown to ‘is blank'.

    g.   Click OK and then check the box ‘Hide this control'.

    Your conditional formatting should look similar to this:

    Once again, preview your form template. After you select a module, you should be able to see the default questions for that module. If you select Module 3 - SharePoint Integration, you should still see only 3 sets of questions - others that have blank values are hidden.

  • qRules and SharePoint-related Commands

    Scenario


    Have you ever wanted to be able to add InfoPath form data to SharePoint list? Sure, promoted properties in your form library are fine – for one layer deep data. Real world data often has one to many relationships, however (think Customers and Orders, or Orders and Products), and SharePoint and InfoPath like to handle that by mushing all your nicely organized information into semi-colon delimited lists. Not so pretty, not so useful.


    Perhaps you also have attachments in your form that you’d like added to existing list items, speeding up your form by keeping it sleek and having the attachments out of the XML where they are easier to find. InfoPath and SharePoint won’t do this for you, but qRules can.


    What about updating your list items in your InfoPath form if they were changed after the form was submitted and items were submitted to your list? Wouldn’t that be great? You could have the best of both worlds.


    Value Proposition


    You could write code to submit your list items. You could even add a secondary data connection to your form to help you generate CAML and submit repeating items one at a time. Of course, that means you have to write and maintain code, or ever worse, rely on your users to push the “Submit” button on each item. They’d never forget to do that, right?


    With qRules, you can easily add the ability to submit information from your form to a list or to two lists. You can map the fields you want to submit. You can use additional commands to add any attachments to the list items. And, if you want, qRules will even refresh the list items in the form with the latest from the list. qRules consists of modular commands that you can leverage together to create powerful forms with all the features that custom code provides and none of the maintenance that custom code carries along with it.


    Requirements


    • qRules v2.3
    • Access to the SharePoint List you wish to submit items to
    • InfoPath To SharePoint List tool for mapping (this tool is provided with qRules)
    • Note: This document was written for SharePoint 2007. If you run into questions when trying these steps for SharePoint 2010, please contact support at qdabra dot com.

    Click on this link to download the documentation that covers the following qRules commands:


    • SubmitToSharePointList
    • RefreshSharePointListItems
    • AttachToSharePointList
    • Extra: SharePoint DeleteAttachment operation

  • How to Use Qdabra’s Encryption XTP

    qRules v2.1 comes with new commands called Encrypt and Decrypt. These allow password-protecting your InfoPath form controls to hide sensitive data. Encryption transforms strings and attachments into a set of random characters, while Decryption reveals the original content after entering the password that’s used to protect the data. Be sure to save your password(s)—Qdabra does not record them.

    To get you started on using qRules encryption in your forms, Qdabra created a template part that you can easily add in your InfoPath Custom Controls and drag over to your forms. It’s called the QdEncryption XTP.

    Quick preview:

    In the screenshot above, the user enters a password and fills out the text field. Clicking on the Encrypt button yields this:

     

    As an added security measure, Qdabra uses a font we called ‘qDots’ to hide the actual texts in the password field. This font comes with the QdEncryption XTP package. To take advantage of it, you should install the font in every machine that will use your form.

    This blog post details the step-by-step instructions on how to use the QdEncryption XTP.

    ADD THE TEMPLATE PART IN INFOPATH CUSTOM CONTROLS

    1. Launch InfoPath and select Design a Form Template based on a new blank one.
    2. In the Controls taskpane, click Add or Remove Custom Controls…

    1. In the Custom Controls dialog box, click Add > Template Part, and browse to the location where you placed your QdEncryption XTP

       

    1. Verify that the XTP has been added to your Custom Controls taskpane.

    1. Save your blank form template (XSN). For the purposes of this tutorial, we will name it as QdEncryptionXSN.
    2. Close InfoPath.
    Inject qRules and the XTP in your Form Template
    1. Launch the qRules Injector from Start > All Programs > Qdabra > Tools > qRules Injector.

    1. Browse to the location where you saved your QdEncryptionXSN.
    2. Click Inject, then OK in the confirmation dialog, and then close the qRules Injector.
    3. Open QdEncryptionXSN in InfoPath Design mode.
    4. Scroll down to the very bottom of the Controls taskpane to get to the Custom section, and then click on the QdEncryption control.

    You should now have the template part on your canvas. The main and the secondary data sources will be injected in your XSN as well.

    Source Files Clean-up

    If you go to Tools > Data Connections, you will notice that you have two instances of QdabraRules, one for the XSN, and one for the XTP:

     

    When you first injected qRules in your XSN, it added the QdabraRules XML as a secondary data source. In this same XSN, you injected the QdEncryption XTP which also uses qRules. This added another QdabraRules XML secondary data source to the XSN (with a different name). So now, you have two qRules XMLs, which is confusing and might cause issues when calling the qRules commands. Unfortunately, there is no workaround at the moment, hence the need to do some clean-up.

    1. Save QdEncryptionXSN as source files and close InfoPath.
    2. Modify the manifest.xsf file:

    a.        In the directory where you saved your source files, locate manifest.xsf and open it in any text editor.

    b.       Replace all 25 instances of "QdabraRules_QdEncryption" with "QdabraRules".

    c.        Delete the associated blocks where you find "QdabraRules1":

                                                                   i.      xsf:file (for .xsd)

     

                                                                  ii.      xsf:file (for .xml)

     

                                                                iii.      xsf:dataObject

     d.     Replace all 12 instances of /xpath=/my:qdEncrypt with /xpath=/my:myFields/my:qdEncrypt

     e.      Replace all 12 instances of /pass=/my:qdEncrypt with /pass=/my:myFields/my:qdEncrypt

    Note that in Steps d and e above, we are replacing the XPaths with /my:myFields. If you have a different name for your main data source group node, please use that instead of myFields.

     f.       Save and close manifest.xsf.

    1. Modify the view.xsl file.

    a.       Open view1.xsl in a text editor.

    b.       Replace the 7 instances of “QdabraRules_QdEncryption” with “QdabraRules”.

    c.        Save and close view1.xsl.

    1. Modify the sampledata.xml file

    a.        Open sampledata.xml in a text editor.

    b.       Delete the xd:DataConnection block where you find “QdabraRules_QdEncryption”.

    c.        Save and close sampledata.xml.

    1. Delete the extraneous QdabraRules1 files in the source files directory:

    a.       QdabraRules1.xml

    b.       QdabraRules1.xsd

    1. Verify changes.

    a.       Open manifest.xsf in InfoPath Design mode.

    b.       Go to Tools > Data Connections and verify that you now have only one instance of QdabraRules.

    Test Your Form Template

    Test the encryption in Preview mode:

    1.       Enter a password.

    2.       Fill out any of the fields you wish to encrypt.

    3.       Click on the Encrypt button corresponding to the field you’ve filled out.

    A ‘Success’ message is shown upon successful encryption.

    If you’ve encrypted a text field, the control will be hidden. The texts will be replaced with random characters starting with “qdEncrypted”, like shown:

    An expression box is displayed instead:

    4.       Enter the password that you used to encrypt and click Decrypt. This will reveal the original texts.

     If you’ve encrypted an image or a file attachment, the attachment will be hidden. An expression box is displayed instead. Decrypting reveals the attachment.

    5.       You may also test encrypting/decrypting the fields all at once by entering a password and filling out all the fields.

    Clicking on the Encrypt All button will show:

    To decrypt, enter the password that you used to encrypt, and click Decrypt All.

    6.       Also try entering a wrong password when decrypting. This will return an error message.

    Additional Notes

    Below are some guidelines that will help you, should you wish to customize the template part or wish to create your own InfoPath forms using the qRules Encrypt and Decrypt commands:

    · Arguments:

    o    /xpath: XPath to the field to encrypt/decrypt

    o    /dsnamepass – (optional) Data Source name for Password field if it is in a secondary data source

    o    /pass: XPath to the password field

    o    /clear: (optional) can have a value of yes or no. If set to yes, the password will be

          cleared after encryption/decryption. If unspecified, the value defaults to yes. 

    · Examples:

    o    Encrypt /xpath= /my:myFields/my:textEncrypt /pass=/my:myFields/my:password

    o    Encrypt /xpath=/my:myFields/my:imageEncrypt  /pass=/my:myFields/my:password /clear=no

    o    Decrypt /xpath=/my:myFields/my:fileEncrypt   /dsnamepass=myEncryption /pass=/myEncryption/Password

    o    Decrypt /xpath=/my:myFields/my:group1/my:group2/my:field1[../my:field2='a'] /pass=/my:myFields/my:password

    · Additional Observations:

    o    Encrypting/Decrypting file or image attachments will make the control appear empty in the form because it can’t read the filename and extension from the string any longer. However the encrypted string will always start with “qdEncrypted”. Conditional formatting can be based off that to hide a control if the node starts with qdE, and display an expression box instead.

    o    Fields that use whole number or decimal as data types can be encrypted/decrypted; but since we are returning a string, the field will return a data validation error.

    o    You cannot encrypt/decrypt a secondary data source field because every time we pull data into a form from a secondary data source, it would be the actual data. Encrypting it would only be until the data was refreshed, since it isn’t stored with the form.

  • Working with a qRules solution that uses DBXL and MOSS 2007

    With DBXL, you can quickly integrate your solution with SharePoint 2007 and IPFS in order to create a browser-based solution. However, the challenge is that InfoPath Forms Server can only open documents from SharePoint document libraries. Connecting an existing form template with DBXL for use on IPFS can be done by using code to access the DBXL web services; but now that there’s qRules, all this can be done without the need of writing code.

    NOTE: For a browser enabled, InfoPath 2010 form template, injected with qRules v2.4 and used on SharePoint 2010 and DBXL v2.4, please refer to this document.

    Since browser forms allow users to pass in custom parameters via the URL, we will pass in the DBXL document ID (DocID) using the qRules command called GetInputParameter. If passed in, we use a data connection to DBXL to retrieve the document then replace the main DOM with the retrieved XML using the new qRules command called SwapDomWithDocument.

    This document details the steps on how to configure your qRules-based solution that can submit documents to DBXL and load them in IPFS. This requires qRules v2.1 (or later) and DBXL v2.3 (or later). For creating SharePoint data views, SharePoint Designer is required.

    The document outlines the following:

    ·        Create the data connections

    ·        Configure the qRules commands

    ·        Configure the submit command

    ·        IPFS-enable your form template

    ·        Publish your form as an admin-approved form template

    ·        Create an IPFS-enabled SharePoint library

    ·        Create a document type in DBXL

    ·        Test the solution

    ·        Create a data view to access your DBXL forms

    Create the Data Connections

    Our solution will use two web service data adapters, one called GetDocument which will retrieve document data from DBXL, the other called SubmitDocument which will post a modified document back to DBXL.

    1. Design your qRules-injected form template in InfoPath.
    2. Add the GetDocument data connection:

    a.        Go to Tools>Data Connections and click Add.

    b.       Select Create a new connection to: Receive data and click Next.

    c.        Select Web Service in the next screen and Next.

    d.       For the Web Service URL, enter the location of the Qdabra DBXL Document web service. In default DBXL installations, the format would be: http://<YourServerName>/QdabraWebService/DbxlDocumentService.asmx. Click Next.

    e.       Select GetDocument from the list of operations and click Next.

    f.         Double-click on the tns:docId parameter and enter the number ‘0’ (zero), then click Next.

    g.        No value is needed for next tns:docId parameter, so leave it blank and click Next twice.

    h.       Give your data connection a name of your choosing. For this document, we will GetDocument. We will use this name later when we configure our qRules command.

    i.         Uncheck the box ‘Automatically retrieve data when the form is opened’ and click Finish.

    1. Add the SubmitDocument data connection:

    a.        Back in the Data Connections dialog box, click Add.

    b.       Select Create a new connection to: Receive data and click Next.

    c.        Select Web Service in the next screen and click Next.

    d.       For the Web Service URL, enter the location of the Qdabra DBXL Document web service which is the same as what we used in the previous step (http://<YourServerName>/QdabraWebService/DbxlDocumentService.asmx), and click Next.

    e.       Select SubmitDocument from the list of operations and click Next three times, leaving the rest of the defaults.

    f.         Give your data connection a name of your choosing. For this document, we will use SubmitDocument. We will use this name later when we configure our qRules command.

    g.        Uncheck the box ‘Automatically retrieve data when the form is opened’ and click Finish.

    h.       Click Close to exit out of the Data Connections dialog.

    Configure the qRules Commands

    Now that we’ve added our data connections, we need to add rules to the finishedLoading attribute of the QdabraRules (Secondary) data source. This will trigger getting the input parameters on load and use those parameters with the SwapDomWithDocument commmand.
    1. In the Data source taskpane, switch to the QdabraRules (Secondary) data source.
    1. Right-click on the finishedLoading node and select Properties.
    2. In the field properties window, switch to the ‘Rules and Merge’ tab and click Add.

         4.       The first rule will simply stop the succeeding rules to run if the conditions are met. Click on the Set Condition button and add two conditions as shown:

     

         5.       Click OK.

         6.       Check the box ‘Stop processing rules when this rule finishes’. No action is needed for this rule. It should look similar to this: 

    1. Give your rule a name of your choosing and click OK.
    2.  Click Add to add another rule that will call the qRules GetInputParameter command and will use ‘DocID’ as the key.
    3. Click Add Action and leave the first dropdown with the action “Set a field’s value”.
    4. Click on the schema icon next to Field and select the Command node from the QdabraRules (Secondary) data source.
    1. Click OK.
    2. In the Value box, enter the command string: GetInputParameter /key=DocID. (Note that DocID is case-sensitive. It should match the specified parameter in the URL that we will set up in the later part of this document.) Your rule action should be similar to this:

      13.   Click OK twice and then click Add to add the third rule.
    1. The third rule will stop the succeeding rule to run if the specified condition is met. Click on the Set Condition button and add a condition as shown:
     

        15.   Click OK.

        16.   Check the box ‘Stop processing rules when this rule finishes’. Again, no action is needed for this rule. It should look similar to this:

       17.   Click OK, then click Add to add the last rule that will call the qRules SwapDomWithDocument command and will use the resulting ‘DocID’ returned by the GetDocument data connection.
    1. Click Add Action and leave the first dropdown with the action “Set a field’s value”.
    2. For the Field, select the Command node from the QdabraRules (Secondary) data source.
    3. For the Value, click on the fx button and enter the formula:
    concat("SwapDomWithDocument /getdocument=GetDocument /docid=", Result)where the /getdocument parameter is the name of your GetDocument data connection, and /docid is the Result node of the QdabraRules (Secondary) data source. Your formula should look like this:

     

    21.   Click OK three times. We now have four rules in the QdabraRules finishedLoading node:

    22.   Click OK to close the Field Properties window.

    CONfigure the Submit Command

    We will use the qRules command called SubmitToDbxl via rules to enable our forms to submit to DBXL. For this, we will add a button that will trigger the submit rule. (For more detailed, step-by-step instructions, see the tutorial Use qRules to submit to DBXL.

    The SubmitToDbxl qRules command allows specifying three values to use as metadata for each of the forms that are submitted to DBXL.  These values are:

    ·         Name – A title for each form

    ·         Author – The name of the person who created the form, or who last modified it, depending on how you would like to use this value.

    ·         Description – A description for each form

    In order to make these values dynamic, we will use the fields in our form corresponding to each of these metadata values.

    1.       Add three text fields in your form, as shown:

    2.       Drag these fields on your form canvas.

    3.       Next, we will add our submit button. In the Controls taskpane, click on the Button control to add it onto your view.

    4.       Double-click on the button on your canvas to see its properties.

    5.       Label your button ‘Submit’ and give it an ID of your choosing, e.g. btnSubmit.

    6.       Click on Rules, and then Add.

    7.       Give your rule a name of your choosing and click Add Action.

    1. Leave the first dropdown with the action “Set a field’s value”.
    2. For the Field, select the Command node from the QdabraRules (Secondary) data source.
    3. For the Value, click on the fx button and enter the formula:
    concat("SubmitToDbxl /submit=SubmitDocument /doctype=qRulesForms /name=", Name, " /author=", Author, " /desc=", Description)

    where we are concatenating the values in the following parameters:

    ·         /submit – name of the SubmitDocument data connection

    ·         /doctype – specifying a value in this parameter is the same as ‘hardcoding’ the document type name. Since we want to submit forms via IPFS, we will have to declare the doctype in our qRules command. You may give it any name of your choosing, but remember that we will use this when we create our document type in DBXL later. For this document, we will use the name ‘qRulesForms’.

    ·         /name, /author, /desc – the underlines indicate that these are the field that you created above. If you click the Edit Xpath (advanced) checkbox, you should see the full XPaths of the fields.

    Your formula should look like this:

    11.    Click OK to close all the dialogs.

    12.    Our sample form will simply look like shown:

    IPFS-enable your form template

    1.       Go to Tools > Form Options > Compatibility, and enable browser-compatibility:

    2.       Make sure that the Submit button (since it makes use the qRules command) is set to ALWAYS send data to the server. To do this, double-click on the Submit button to show its properties, and go to the Browser forms tab, then select Always.

     
    1. Save your form template to your network or local hard drive. For the purposes of this document, we will name our form template 'qRulesForms'.
    Publish your Form as an Admin-Approved Template

    Since qRules injects code into your forms, you will have to publish your XSN as an admin-approved form template. This allows you to manage the form in one place and use it in many places.

    1. In InfoPath’s menu, go to File > Publish.
    2. Select the option to publish the form template ‘To a SharePoint Server with or without InfoPath Forms Services’ and click Next.
    1. Enter the address of your SharePoint or IPFS site and click Next.
    2. The next page will allow you to publish your form as an Administrator Approved form template. Make sure that option is selected and click Next.
    1. Browse to the local or network location where you wish to save your published form template to, click Save and then click Next.
    2. Add some columns to be promoted to the SharePoint library and click Next, and then click Publish.

    You will see a message that your form was published successfully and you are to give your SharePoint Administrator the information listed on the screen.

    7. Click Close and close InfoPath.You need to be a SharePoint Administrator with access to SharePoint Central Administration to complete the next steps.

    8. Navigate to the Central Administration web site.

    9. Click on the Application Management tab.

    1.  Under InfoPath Forms Services, click Manage form templates.
     
    1.  In the ‘Manage Form Templates’ page, click Upload form template.
    1.  In the ‘Upload Form Template’ page, browse to the location where you saved your published form template and click Save.
    1.  Accept the other defaults and click Upload. You should see a message indicating a successful upload. Click OK.
    2. In the ‘Manage Form Templates’ page, click on the down arrow next to the template that you just uploaded and select Activate to a site collection.

    15. If the Activation Location Site Collection shows an incorrect site, click on the down arrow next to Site collection and select Change Site Collection. (Note: SharePoint almost always defaults to the wrong site collection the first time a form template is activated).

    16.    In the pop-up window, click the Web Application selector menu and choose Change Web Application.

    17.    Click SharePoint - 80, and then click the / to activate to the entire site collection. Click OK twice.

    18.    Close Central Administration.
     Create an IPFS-enabled SharePoint libary

    1.       Navigate to the Site Collection in Internet Explorer.

    2.       Click Site Actions > Create

    3.       Click Document Library or Form Library to create new library.

    4.       Continue to the page to create your new library. Give it a name of your choosing. For the purposes of this document, we will name our library ‘qRulesForms’. Select the options as desired, then click Create.

    5.       Go to the library created and click Settings > Form Library Settings.

    6.       Click Advanced settings under General Settings.

     

    7.       In the Advanced Settings Page, select Yes under Allow management of content types, click Display as a Web page to open forms in the browser, then click OK.

    8.       Back on the Library Settings Page, you should now see a section called Content Types. Choose the link Add from existing site content types.

    9.    Find your administrator-deployed template name in the Available Site Content Types list box and click Add, then click OK.

    10. Back in Settings page, click Change new button order and default content type under Content Type section.

    11. Uncheck the Visible check box for Content Type ‘Form’ or ‘Document’ and click OK.

    Now when users click the New button in the document library, your Administrator-Enable form will launch.

     Create a document type in DBXL

    1.       In DBXL, click on New Configuration.

    2.       In the General tab, Document Type details section, enter the Document Type Name, making sure that it matches the same name that was hardcoded into the form. In this case, we used the name ‘qRulesForms’.

    3.       Click on the file attachment control in the InfoPath Form Template section and attach the admin-approved form template that you have published and saved locally (i.e. not the one in SharePoint).

    4.       Click Save, and then OK in the confirmation dialog.

     Test the Solution

    1.       Test creating and updating a new document from the browser.

    a.        In the DBXL Administration Tool (DAT), click the Documents tab and observe that there are no documents listed.

    b.       In your IPFS library, click on the down arrow next to New and select the admin-approved form template that you have published.

    c.         The form will open in the browser. Fill out the fields and click on the Submit button. (Do not close the form.)

    d.       In DAT, click Refresh and verify that the submitted document appears.

    e.       Back in the form in IPFS, modify the description and click Submit.

    f.         In DAT, click Refresh and verify that the document is now showing the modified value in the Description column. Notice that the DocID column has not changed because the form is now connected to the previously submitted document.

    2.       Test opening and updating an existing document from the browser.

    a.        To open an existing document, specify the DocID parameter in the URL.

    You can identify a document ID by looking in DAT under the DocID column. The URL to open this document would then look like: http://<YourServerName>/_layouts/formserver.aspx?XsnLocation=/FormServerTemplates/<FormTemplatePublished>.xsn&OpenIn=Browser&DocID=<DocumentID>.

    b.        In a new web browser window, navigate to this URL, replacing <YourServerName> with yours, changing <FormTemplatePublished> with the name of your admin-approved template which in this case is ‘qRulesForms’, and setting the <DocumentID> parameter to the one for your document. In this case, the document we have submitted in Step 1 has a DocID of 253. Your URL should then look like: http://mySharePointSite/_layouts/formserver.aspx?XsnLocation=/FormServerTemplates/qRulesForms.xsn&OpenIn=Browser&DocID=253.

    c.        Verify that your form opens in the browser without errors.

    d.       Modify the description and click Submit.

    e.       In DAT, click Refresh and verify that the document shows the changed value in the Description column.

    3.       Test submitting documents via DBXL and opening them in the browser.

    a.        In DAT, go to the General tab and click on the Download icon  to open the form in InfoPath.

    b.       Fill out the form fields and click Submit.

    c.        Go to the Documents tab and verify that the submitted document appears.

    d.       Open the document in the browser by passing in the DocID parameter in the URL. Use the same URL as before, replacing DocID with that of the newly-submitted document.

    e.       Verify that your form opens in the browser without errors.

    f.         Continue submitting new documents to have at least 3 in preparation for the next task.

    Create a data view to access your DBXL forms

    To make the process of opening and submitting documents easier, it will be best to add a data view to the SharePoint site that would list all the documents in DBXL via the GetListItems method. This requires the installation of SharePoint Designer.
    1. In the SharePoint Designer menu, go to File > Open Site.
    2. Enter the URL for your SharePoint site and click Open.
    3. In the ‘Folder List’ pane, navigate to the SharePoint library that you created in the previous steps, which in this case is ‘qRulesForms’.
    4. Expand qRulesForms > Forms, and double-click on AllItems.aspx to open it in the designer.
    5. In the menu, go to Data View > Manage Data Sources.

    6.       Under XML Web Services, click Connect to a web service.

    7.       Enter the Service Description Location (URL) to the DBXLDocumentService, usually located at http://<servername>/QdabraWebService/DbxlDocumentService.asmx, and click Connect.

     

    8.       In the Operation dropdown, select GetListItems.

    You should be able to see the following:

    9.       Select listName and click Modify, then enter the name of the Document Type you wish to query. Remember that we have already created a document type and have named it ‘qRulesForms’.

    10.    Click OK.

    11.    Go to the General tab and enter a name for the connection.

    12.    Go to the Login tab and select Use Windows authentication, then click OK.

    13.    The new web service connection will show up under XML Web Services in the Data Source Library. Click the down arrow for the connection you just created and click on Show Data.

    The Data Source Details tab will show the columns retrieved from the Document Type. For the purposes of this document, we will do the following:

    14.    Hold down the Ctrl key and use your mouse to click on the DocID, Name, Author and Description.

    15.    Drag and drop these columns onto a location on the page where you wish to display this data. Your canvas should now look like this:

    16.    Add a hyperlink to open the documents in the browser:

    a.        Click on  next to any entry in the column you wish to display form links in. A menu will appear:

    b.       Select Hyperlink in the ‘Format as’ dropdown. Click Yes when prompted.

    c.        In the ‘Edit Hyperlink’ dialog, click on the Parameters button.

    d.       Remove the text in the Path field and enter http://<YourServerName>/_layouts/FormServer.aspx, replacing <YourServerName> with yours.

      1. Click on the Add button to start adding your query string parameters:

    i.         In the Name field, enter XsnLocation.

    ii.        In the Value field, enter the relative path to the published form template, e.g. /FormServerTemplates/qRulesForms.xsn, then click OK. 

    Continue to add the following parameters:

    iii.      DefaultItemOpen = 1 

     

    iv.      DocID = {@DocID} (Select XSL: DocID from the Value dropdown and remove the @ sign in the Name)

     

    v.        OpenIn = Browser

     

    vi.      Source = (relative path where the user is taken when they close the document), e.g. /qRulesForms/Forms/AllItems.aspx.

     
    You should now have the following Query strings: 

     

    f.         Click OK.

    g.        In the ‘Edit Hyperlink’ dialog, enter {@Name} as the text to display.

     

    h.        Verify that the link generated in the Address field is correct. The address should be in the format: http://<YourServerName>/_layouts/formserver.aspx?XsnLocation=/FormServerTemplates/<FormTemplatePublished>.xsn&DefaultItemOpen=1&DocID={@DocID}&OpenIn=Browser&Source=/<YourSharePointLibary>/Forms/AllItems.aspx

    i.         Click OK to close the Edit Hyperlink dialog.

    17.    In the menu, click File > Save to save the changes to your SharePoint library.

    18.    In Internet Explorer, navigate to your SharePoint library. You will now see your new data view added onto your SharePoint library.

    Test opening new forms in the browser by clicking on the New link, and submitting using the Submit button. Your form will be submitted to DBXL and get displayed on your SharePoint data view. Test opening existing forms and verify that they open in the browser, and that you can modify and submit any changes.

     

    Posted May 29 2010, 06:28 AM by jose cruz with 1 comment(s)
    Filed under: , ,
  • How to use the SetValue command

    InfoPath allows us to set the value of a target field by using rules. We can even filter which field we want to set the value of. However, it can be a problem if that field happens to be in a repeating group.

    The qRules SetValue command allows us to define the XPath to the target field. Using XPath filters with the SetValue command, setting a field’s value can be extremely easy when dealing with repeating data.

    ·         Arguments:

    o    xpath: XPath to the field to set

    o    value: New value for the field being set

    ·         Examples:

    o    SetValue /xpath=/my:myFields/my:Group/my:RepeatingGroup/my:field2[../my:field1='abc'] /value=ABC

    o    concat("SetValue /xpath=my:myFields/my:Group/my:RepeatingGroup/my:field2[../my:field1='", Filter, "'] /value=", Value)

    This document assumes that you already have a qRules-injected form template. To demonstrate how the above examples work, design your form template based on the following guidelines/steps:

    1.       Your main data source structure should be similar to this (all use a string data type):

    2.       You have the following layout and controls on your canvas:

    3.       In your ‘Set Value’ button properties, click on Rules.

    4.       Add a rule that has an action that sets the value of your QdabraRules (Secondary) data source Command node:

    to: SetValue /xpath=/my:myFields/my:Group/my:RepeatingGroup/my:field2[../my:field1='a'] /value=Test

     

    5.       Preview your form template.

    6.       Insert at least 5 items in your repeating table.

    7.       In the Field 1 column, fill out some fields with the text ‘a’, and others with random texts, like shown:

    8.       Click on the ‘Set Value’ button. You should get the result as shown:

     

    In this example, we set our qRules Command to:

    SetValue /xpath=/my:myFields/my:Group/my:RepeatingGroup/my:field2[../my:field1='a'] /value=Test

    Using this command syntax, qRules will set the value of any row in the Field 2 column that has ‘a’ in Field 1. It sets the value of Field 2 to ‘Test’.

    Like the other qRules command, you can also use a ‘concat’ statement if you wish to use specific fields with dynamic values in your parameters. For the next example, we’ll use the command syntax:

    concat("SetValue /xpath=my:myFields/my:Group/my:RepeatingGroup/my:field2[../my:field1='", Filter, "'] /value=", Value)

    9.       Back on your canvas in Design mode, change your button rule to set the value of the qRules Command node to the concat statement above. Note that since ‘concat’ is an InfoPath function, you will have to enter it as a formula, pointing Filter and Value to their respective nodes in the main data source:

    10.    Preview your form template.

    11.    Enter ‘John’ in the Filter text box and ‘John Smith’ in the Value text box.

    12.    Insert at least 5 items in your repeating table, filling out some fields with the text ‘John’, and others with random texts, like shown:

    13.    Click on the ‘Set Value’ button. You should get the result as shown:

    When you’ve started using the SetValue command in your InfoPath solutions, you’ll see how helpful it is and how it can make dealing with repeating data easier.

  • Qdabra’s AdUserInfo XTP

    Qdabra’s AdUserInfo template part is useful for solutions that require sending of forms via email. Populate your ‘From’ and ‘To’ fields with valid email addresses that are retrieved from the Active Directory.

    HOW IT WORKS

    This is how the template part looks in InfoPath Preview mode:

    Clicking the ‘Click to Get Your Info’ button retrieves the current user’s AD information and stores the name, alias and email address in the XML.

    In the text box on the right, enter a valid alias for the user you wish to send email to. After tabbing out, that user’s AD info is retrieved using Qdabra’s Active Directory Web Service. This way, we are assured that the form will be sent to a valid email address.

    HOW TO ADD THE XTP IN INFOPATH

    1. Launch InfoPath and select Design a Form Template based on a new blank one.
    2. In the Controls taskpane, click Add or Remove Custom Controls… 
    3. In the Custom Controls dialog box, click Add > Template Part, and browse to the location where you placed your AdUserInfo XTP. 
    4. Verify that the XTP has been added to your Custom Controls taskpane. 
    5. Drag the XTP from taskpane to your canvas. You will see the following section: 
    6. Your Main Data Source should look similar to this:

    7. Go to Tools > Data Connections. You will see that there are two data connections that got added as well.
    8. These data connections retrieve data using Qdabra’s Active Directory Web Service. If you already have DBXL installed, you can use the AD web service that comes with it.

    9. Modify the data connections and replace the URLs to point to the location of your web service installation, i.e. http://<YourServerName>/QdabraWebService/AdUserInfo.asmx. If you are using Qdabra’s AD Standalone Tool, replace the web service URL in the format: http://<YourServerName>/QdabraAD/AdUserInfo.asmx.
    10. As you modify your data connections, you might want to remove ‘_AdUserInfo’ in the data connection names. Those got appended when you injected the XTPs.

    When done with the above steps, you can start testing your form template in Preview mode.

    Download Qdabra's AD User Info XTP for FREE here.

  • Qdabra's Image Picker Template Part

    SCENARIO

    You want to add images to your InfoPath form, but:

    • Image attachments, even those that are embedded in the form, get stored in the XML itself, thus making its file size huge.
    • Your images are stored in a SharePoint list and cannot be retrieved via filters without using code.

    SOLUTION

    Install Qdabra’s Image Picker template part!

    • Based on Qdabra’s qRules library – extend your InfoPath forms without writing code
    • Easy-to-add XML Template Part – just add custom control via the InfoPath 2007 Designer
    • Comes with pre-configured layout which saves you time – just drag and drop from the taskpane
    • Less file size since no images are attached nor embedded in the XML – the images are loaded from the external SharePoint file.
    • Able to query images from a SharePoint list – filter using image tags for easy searching, without code!

    Note that the QdImagePicker XTP uses a picture control to hold the images. Since picture controls are not supported in InfoPath Forms Services (IPFS), the template part will not work in the browser.

    QUICK PREVIEW

    Let’s take a quick look: here is a screenshot of Qdabra’s ImagePicker XTP:

     

    In the screenshot above, the user searched for images that were tagged with ‘Logo’ as the Subject and returned two images. The user then clicked on the ‘View’ link for the first entry to display the actual image as well as its properties, as shown below:

     

    Clicking on the ‘Use Selected Image’ button leaves the image on the form and a button that lets the user pick a different image.

     

    The ‘Add’ tab becomes handy if the user wants an image that is not in the SharePoint list, but is on his network or local machine. Simply add the image to the picture control and click ‘Use This Image’.

     

    The newly-added image is then uploaded to your SharePoint library/list.

    This blog post details the steps needed before you begin using the XTP in your InfoPath forms; just a few modifications and you’re ready to go!

    REQUIREMENTS

    • QdImagePickerXTP – Image Picker template part. Download it FREE here.
    • InfoPath 2007 – template parts (XTPs) are not supported in InfoPath 2003.
    • Qdabra qRules v2.0 – add the most commonly requested InfoPath features without the need of writing code. Download a FREE trial here.
    • A SharePoint list to retrieve and submit images to.

    SET UP A SHAREPOINT LIST WITH IMAGES

    1. In your SharePoint site, create a list. For the purposes of this tutorial, name your list ImagePickerList.

    2. Add the following columns:

     

    3. In your main ImagePickerList view, i.e. http://<SharePoinSite>/Lists/ImagePickerList/AllItems.aspx, click on the ‘All Items’ dropdown and select ‘Modify this View’.

     

    4. In the ‘Edit View’ page, ‘Columns’ section, enable only the following columns and (optional) sort them as shown below:

     

    5. Click OK when done.

    6. Back in your ImagePickerList view, click New > New Item.

     

    7. In the ‘New Item’ page, fill out all the fields, like such:

     

    Hints:

    • Subject – this is the main tag used in the QdImagePicker XTP when searching for images. Since in your XTP, the Subject dropdown list box uses the following entries: Animals, Business, Family, Landscape, Logo, People, Travel, and Other; make sure to tag your images using only one of these values.
    • IsPrivate – can either be ‘true’ or ‘false’.
    • Image – the URL to the image

     

    •  
      • If you wish to upload an image from your network or local machine:

    a. Leave the Image field blank for now.

    b. Click on the ‘Attach File’ link in the New Item page

     

    c. Browse to the image and click OK.

     

    The ‘Attachments’ field will now appear in your ‘New Item’ page:

     

    Note that the Image field will remain blank.

    d. Click OK.

    e. Back in your list main view, click on the Title dropdown of your newly-added image and select ‘Edit Item’.

     

    f. You will be taken to the ‘Edit Item’ page where you’ll see the image attachment filename which now shows as a hyperlink. Right-click on the link and select ‘Copy Shortcut’ to place the image URL in your clipboard.

     

    g. Paste the image URL in the Image field:

     

    h. Click OK.

    You now have your first Image item in your SharePoint list:

     

    You would want to add more images to this list so that when you begin using your QdImagePicker XTP in your forms, you will have a couple of images to pick from. We recommend adding the images that you use most of the time, such as company logos, banners, signatures, etc.

    For the purposes of this tutorial, we will use the following entries in our SharePoint list:

     

    ADD THE TEMPLATE PART IN INFOPATH CUSTOM CONTROLS

    1. Launch InfoPath and select Design a Form Template based on a new blank one.

    2. In the Controls taskpane, click Add or Remove Custom Controls…

     

    3. In the Custom Controls dialog box, click Add > Template Part, and browse to the location where you placed your QdImagePicker XTP.

     

    4. Verify that the XTP has been added to your Custom Controls taskpane.

     

    5. Save your blank form template (XSN). For the purposes of this blog post, we will name it as ImagePickerXSN.

    6. Close InfoPath.

    INJECT QRULES AND THE XTP IN YOUR FORM TEMPLATE

    1. Launch the qRules Injector from Start > All Programs > Qdabra > Tools > qRules Injector.

     

    2. Browse to the location where you saved your ImagePickerXSN.

    3. Click Inject, then OK in the confirmation dialog, and then close the qRules Injector.

    4. Open ImagePickerXSN in InfoPath Design mode.

    5. Scroll down to the very bottom of the Controls taskpane to get to the Custom section, and then click on the QdImagePicker control.

    You should now have the template part on your canvas. The main and the secondary data sources will be injected in your XSN as well.

    SOURCE FILES CLEAN-UP

    If you go to Tools > Data Connections, you will notice that you have two instances of QdabraRules, one for the XSN, and one for the XTP:

     

    When you first injected qRules in your XSN, it added the QdabraRules XML as a secondary data source. In this same XSN, you injected the QdImagePicker XTP which also uses qRules. This added another QdabraRules XML secondary data source to the XSN (with a different name). So now, you have two qRules XMLs, which is confusing and might cause issues when calling the qRules commands. Unfortunately, there is no workaround at the moment, hence the need to do some clean-up.

    1. Save ImagePickerXSN as source files and close InfoPath.

    2. Modify the manifest.xsf file:

    a. In the directory where you saved your source files, locate manifest.xsf and open it in any text editor.

    b. Replace all eight instances of “QdabraRules_QdImagePicker” with “QdabraRules”.

    c. Delete the associated blocks where you find “QdabraRules1”:

    i. xsf:file (for .xsd)

     

    ii. xsf:file (for .xml)

     

    iii. xsf:dataObject

     

    d. Save and close manifest.xsf.

    3. Modify the view1.xsl file.

    a. Open view1.xsl in a text editor.

    b. Replace the two instances of “QdabraRules_QdImagePicker” with “QdabraRules”.

    c. Save and close view1.xsl.

    4. Modify the sampledata.xml file

    a. Open sampledata.xml in a text editor.

    b. Delete the xd:DataConnection block where you find “QdabraRules_QdImagePicker”.

     

    c. Save and close sampledata.xml.

    5. Delete the extraneous QdabraRules1 files in the source files directory:

    a. QdabraRules1.xml

    b. QdabraRules1.xsd

    6. Verify changes.

    a. Open manifest.xsf in InfoPath Design mode.

    b. Go to Tools > Data Connections and verify that you now have only one instance of QdabraRules.

     

    7. Modify the qtpFormLogic data connection and remove the _QdImagePicker suffix in its name.

    ADD A DATA CONNECTION THAT FILTERS DATA FROM YOUR SHAREPOINT LIST

    The owssvr dll file comes with SharePoint. Clever people have been creating filtered SharePoint data queries by using this DLL. The Qdabra qRules command called FilterOwssvr attempts to make it easier to filter data from a SharePoint list and use it in your InfoPath form.

    Before we start we need to locate a few values that we’ll need during this tutorial:

    A. Owssvr.dll - On MOSS 2007, this file is located at the following URL: http://<SharePointSite>/_vti_bin/owssvr.dll.

    B. List ID – Open the SharePoint list in Internet Explorer, select Settings and List Settings. You’ll see a URL that looks like this: http://<SharePointSite>/_layouts/listedit.aspx?List=%7B51964A2F%2D1C71%2D4C1C%2D969E%2DF5C9764B312B%7D. The List ID is in red, but we need to decode it to obtain the Guid. You can use an online tool such as http://meyerweb.com/eric/tools/dencoder/ to obtain the Guid, which in this case is {51964A2F-1C71-4C1C-969E-F5C9764B312B}.

    Now that we have these values, we can set up our form to receive data from this list.

    1. Confirm your values visually in Internet Explorer by navigating to http://<SharePointSite>/_vti_bin/owssvr.dll?Cmd=Display&List={51964A2F-1C71-4C1C-969E-F5C9764B312B}&XMLDATA=TRUE. You’ll see something like this:

     

    2. In your ImagePickerXSN form template, go to Tools > Data Connections.

    3. Click Add, and follow the wizard to create a data connection that receives data from an XML document, and enter the full URL we accessed in Step 1, i.e. http://<SharePointSite>/_vti_bin/owssvr.dll?Cmd=Display&List={51964A2F-1C71-4C1C-969E-F5C9764B312B}&XMLDATA=TRUE.

    4. Continue the wizard, making sure to select ‘Access the data from the specified location’.

     

    5. Click Next. We’ll name this data connection ‘FilterImages’ and uncheck the box ‘Automatically retrieve data when form is opened’.

     

    6. Click Finish, and then Close to exit out of the wizard.

    RE-BIND SECTIONS TO THE FILTERIMAGES DATA SOURCE

    These sections of the QdImagePicker XTP are bound to the qtpFormLogic secondary data connection.

     

    These sections will hold our SharePoint list images and details. We then need to re-bind them, including the fields, to the ‘FilterImages’ secondary data source.

    1. Start from the outermost section; right-click on it and select ‘Change Binding’.

     

    2. Select ‘FilterImages (Secondary)’ from the ‘Data source’ dropdown and click on the rs:data node, then click OK.

     

    3. Next, re-bind the repeating section; right-click on it and select ‘Change Binding’, then select the z:row repeating node.

     

    4. Do the same for the innermost section; right-click and select ‘Change Binding’, then bind it to the z:row repeating node.

    You should now have all the three sections bound to the ‘FilterImages’ data source:

     

    5. Next, we will modify the expression boxes to point to the nodes in our ‘FilterImages’ data source since these nodes are actually the columns in our SharePoint list. Do this by double-clicking on each expression box, clicking on the fx button under the ‘General’ tab and entering the formula as follows (Note that the underlined fields point to the ‘FilterImages’ secondary data source nodes):

    a. Date – substring-before(@ows_Date_x0020_Taken, " 00:00:00")

     

    b. Title@ows_LinkTitle

    c. Subject@ows_Subject

    d. Location@ows_Location

    e. Creator@ows_Creator

    f. Copyright@ows_Copyright

    g. Private – select ‘Text’ under the ‘General’ tab and on your keyboard, hold Alt + 129 (numeric keypad) to get ü and display a check mark. If you are using a non-English OS keyboard, simply copy ü and paste it in the ‘Text’ field.

     

    Go to the Display tab > Conditional Formatting > Add and add the condition ows_IsPrivateis not equal to’ “true” (entered as text), to hide the control.

     

    h. ID@ows_ID

    i. Image (picture control) – @ows_Image

    MODIFY THE FORM LOGIC

    First, we need to change the rules that call the FilterOwssvr qRules command that are present in the ‘Search’ button.

    1. Double-click on the ‘Search’ button and click ‘Rules’. The last two rules in this button are the ones that use the ‘FilterOwssvr’ command.

     

    2. Double-click on the second rule (No Date Taken), modify the action and click on the fx button.

     

    3. We already have the correct command syntax in there. We just need to insert the correct data connection adapter name, which in this case is ‘FilterImages’.

     

    4. Click OK three times to get back to the ‘Rules’ dialog box.

    5. Do the same actions for the third rule (Date Taken specified); change the data connection adapter name to ‘FilterImages’.

     

    Notice that we’re using ‘Date_x0020_Taken’ in the /filter parameter instead of ‘Date Taken’. This is because, in InfoPath, if our SharePoint List columns have spaces in their names, they are encoded with 'x0020' when retrieved from the data source.

    Also note that the values in this parameter are case-sensitive. If you accidentally give this command an invalid value for the /filter parameter, no error is returned. It is up to the form designer to ensure that the /filter parameter is correct.

    To make sure that we are using the correct values in our /filter parameter, check for the exact node names in your data source (without the :ows_ prefix):

     

    For the same purpose that we need to point the sections and the fields to the newly-added ‘FilterImages’ secondary data source, we also need to change the rules and the conditional formatting in our controls that have any instances of the ‘qtpFormLogic’ Images node to point to the ‘FilterImages’ rs:data node instead. We will do this by looking for logic that uses any of the following nodes:

     

    and replacing them accordingly with these:

     

    6. View button:

    a. Double-click on the button to display its properties.

    b. In the ‘Button Properties’ window, click ‘Rules’ and modify the action in that rule. You will see that it sets the value of ImageDocId to ID that comes from the ‘qtpFormLogic’ secondary data source.

     

    c. Change ID into :ows_ID of the ‘FilterImages’ secondary data source.

     

    You should now have this action in your ‘View’ button rule:

     

    7. FilterImages sections:

     

    Go to each section’s properties by right-clicking on each section and selecting ‘Section Properties’. In the dialog that opens, go to the ‘Display tab’ and click ‘Conditional Formatting’.

    a. data (FilterImages) section (Both conditions hide the control):

    From:

     

    To:

     

    b. row (FilterImages) repeating section:

    From:

     

    To:

     

    c. row (FilterImages) section:

    From:

     

    To:

     

    8. Use Selected Image button:

    a. Modify only the first rule (Copy Image URL) in the button properties:

    Click OK four times to go back to the ‘Insert Formula’ dialog. Your value for the @qRulesLink should look similar to this:

     

    Where the XPath formula for the value is: xdXDocument:GetDOM("FilterImages")/xml/rs:data/z:row/@ows_Image[../@ows_ID = xdXDocument:GetDOM("qtpFormLogic")/FormLogic/View/ImageDocId]

    This formula allows us to retrieve the value of the Image column in our SharePoint list, filtered such that its ID column’s value is equal to the value in the ImageDocID field of the qtpFormLogic secondary data source.

    b. Back in the ‘Button Properties’ Display tab, click on the ‘Conditional Formatting’ button and change the condition from:

    To:

    c. Click OK to close all dialogs.

    <!--[endif]--><!--[if gte mso 10]>

    1.       Use Selected Image button:

    a.        Modify only the first rule (Copy Image URL) in the button properties:

    From:

    To:

    Where the XPath formula for the value is: xdXDocument:GetDOM("FilterImages")/xml/rs:data/z:row/@ows_Image[../@ows_ID = xdXDocument:GetDOM("qtpFormLogic_ImagePicker")/FormLogic/View/ImageDocId]

    This formula allows us to retrieve the value of the Image column in our SharePoint list, filtered such that its ID column’s value is equal to the value in the ImageDocID.

    b.       Back in the ‘Button Properties’ Display tab, click on the ‘Conditional Formatting’ button and change the condition from:

            To:

    c.        Click OK to close all dialogs.

    9. The error expression “Nothing found. Please try a different search criteria.”; change the first conditional formatting from:

     

    to:

     

    We should now have the following conditional formatting in our error expression box (each hides the control):

     

    Lastly, we should also modify the ‘Use this Image’ button which allows us to upload our own images from our network or local machine. This is where we use the SaveToSharePoint qRules command which saves a file, a set of files, an image or a set of images to a SharePoint Document Library or List.

     

    10. Double-click on it to open its properties, and then click ‘Rules’.

     

    11. You’ll see three rules in this button. We need to modify the action in the first rule only since it calls the ‘SaveToSharePoint’ qRules command. In the ‘Action’ dialog box, you’ll see that the Command field is being set to the value: SaveToSharePoint /url=<SharePoint List URL> /xpath=/my:QdImagePicker/my:Image

     

    a. For the /url parameter, replace <SharePoint List URL> with the list URL that we’ve set up earlier in this tutorial, e.g. http://<SharePointSite>/Lists/ImagePickerList, making sure to replace <SharePointSite> with yours.

    b. For the /xpath parameter, replace /my:QdImagePicker/my:Image with the correct XPath for your Image node; in this case, we have: /my:myFields/my:QdImagePicker/my:Image

     

    Your command syntax should then be:

    SaveToSharePoint /url=http://<SharePoinSite>/Lists/ImagePickerList xpath=/my:myFields/my:QdImagePicker/my:Image

    (Again, making sure to replace <SharePointSite> with yours).

    To make our scenario more realistic, let’s add a few fields and make our form template a bit fancy. Here’s what I have in Preview mode:

     

    That’s it! Our form template is all set up and is ready to be published to our SharePoint Site.

    PUBLISH TO A SHAREPOINT SITE

    1. Save all the changes you’ve made in your ImagePickerXSN form template.

    2. In InfoPath’s menu, select File > Publish.

    3. In the ‘Publishing Wizard’, select:

     

    4. Enter the location of your SharePoint site in the next screen.

    5. We will publish this form template in a ‘Document Library’, so select that option and click Next.

     

    6. You can create a new document library with a name of your choosing and promote/display columns as you wish.

    7. When done, click Publish, and then Close to exit out of the wizard.

    You can also add a submit data connection as you normally would if you wish to submit your forms to your SharePoint site. We’ll skip those steps for now since the ImagePicker XTP will function simply by just opening a new form where we published our form template to.

    Open your SharePoint document library and create a new document/form. Fill out your fields, click on that ‘Pick Image’ button and start searching for images! Don’t miss out on the ‘Add’ tab and select any image from your network and local machine!

     

    Once you’ve started using Qdabra’s ImagePicker template part in your InfoPath solutions, you’ll see how easy and neat it is to search and add images in just a few clicks.

    • Download the QdImagePicker XTP for FREE here.
    • Download Qdabra qRules for a FREE trial here.
  • Qdabra's Header-Footer Template Part

    When creating InfoPath solutions, one of the most important aspects is the visual design. This includes making sure that the layout, fonts, colors, white spaces, and most especially, the branding, are all uniform. We can always decide how our forms look like, but for a company to have its unique identity in its InfoPath forms, it should maintain proper branding by using its own company logo.

    Company logos can either be placed in the InfoPath form’s header or footer, or both. Qdabra created a template part that has header and footer sections built-in. We can just change the logo, form title, company details, etc. and start using them in our forms.

    Here’s how the Header-Footer XTP looks:

     

    This blog post details the steps needed to modify the Header-Footer XTP and begin using it in your InfoPath forms.

    REQUIREMENTS

    • Header-Footer XTP – Download it FREE here and save it your local machine.
    • InfoPath 2007 – template parts (XTPs) are not supported in InfoPath 2003.

    MODIFY THE TEMPLATE PART

    1. Launch InfoPath.

    2. In the Getting Started dialog, under the ‘Design a form section’, click Design a Form Template…

     

    3. In the ‘Open a form template’ section, click On My Computer…

     

    4. In the ‘Open in Design Mode’ dialog box, select InfoPath Template Parts (*.xtp) from the file types dropdown.

     

    5. Browse to the location where you saved the Header-Footer XTP and open it.

    6. The template part will open in InfoPath Design mode.

     

    7. Make all the necessary changes:

    a. Header: replace the company logo with your own.

    b. Footer: replace the small logo/icon as well as the company details.

    Note: The Document ID in the footer is applicable only if you have Qdabra DBXL installed. You can delete this whole row if you do not intend to use the form with DBXL.

    8. Save and close the template part.

    ADD THE TEMPLATE PART IN INFOPATH CUSTOM CONTROLS

    1. Launch InfoPath and select Design a Form Template based on a new blank one.

    2. In the Controls taskpane, click Add or Remove Custom Controls…

     

    3. In the Custom Controls dialog box, click Add > Template Part, and browse to the location where you saved your HeaderFooter XTP.

     

    4. Verify that the XTP has been added to your Custom Controls taskpane.

     

    ADD THE TEMPLATE PART TO YOUR INFOPATH FORM

    1. In your blank InfoPath form template, click or drag the the HeaderFooter XTP from the Custom Controls taskpane. This will add the XTP onto your view.

    2. Highlight or select the entire contents of the HeaderFooter XTP section.

     

    3. Drag the selection outside the section.

     

    4. Delete the empty HeaderFooterXTP section, leaving only the its dragged contents in the view.

     

    5. Delete the HeaderFooterXTP node from the main data source.

     

    6. Modify the two expression boxes in for the Document ID found in the footer.

    Note: You may skip these steps and proceed to Step 7 if you do not intend to use the form with Qdabra DBXL.

    a. Change the conditional formatting for the expression box labeled New.

    i. Right-click on the expression box and select Conditional Formatting

     

    ii. In the ‘Conditional Formatting’ window, click Modify.

    iii. Delete my:HeaderFooterXTP in the formula.

     

    iv. Click OK twice to close the dialogs.

    b. Change the formula for the Document ID expression box.

    i. Right-click on the expression box and select Expression Box Properties…

     

    i. In the ‘Expression Box Properties’ window, under the ‘General’ tab, click on the fx button.

    ii. Check ‘Edit XPath’ in the Formula dialog and delete my:HeaderFooterXTP

     

    iii. Click OK twice to close the dialog boxes.

    iv. Repeat all the steps in 6a above but this time, changing the conditional formatting for the blank Document ID expression box.

    7. Change the formula for the Form Version expression box in the footer.

    a. Right-click on the expression box and select Expression Box Properties…

    b. In the ‘Expression Box Properties’ window, under the ‘General’ tab, click on the fx button.

    c. Check ‘Edit XPath’ in the Formula dialog and delete my:HeaderFooterXTP

     

    d. Click OK twice to close the dialog boxes.

    That’s it! You can now design your form to suit your company needs. By having all your forms designed this way, ensure that you are maintaining uniformity and proper branding in your InfoPath solutions.

  • Qdabra's Zero-ActiveX Contact Selector XTP

    PROBLEM

    You want to use the InfoPath Contact Selector to add multiple contacts to your form, but:

    • Selecting multiple users with Contact Selector requires code
    • Contact Selector is an ActiveX control and requires installation on client machines
    • Contact Selector doesn’t work for browser-based forms when the user is not using Internet Explorer

    SOLUTION

    Install Qdabra’s Zero-ActiveX Contact Selector

    • Based on Qdabra’s qRules library – extend your InfoPath forms without writing code
    • Easy-to-add XML Template Part – just add custom control via the InfoPath 2007 Designer
    • Comes with pre-configured layout which saves you time – just drag and drop from the taskpane
    • No ActiveX – works with browser based forms

    QUICK PREVIEW

    Let’s take a quick look: here is a screenshot of Qdabra’s Zero-ActiveX Contact Selector XTP

     

    In the screenshot, the user searched for all users with “admin” in their Active Directory records and then clicked on the arrows to add Jim Cantwell and Patrick Halstead to the form.

    This blog post details the steps needed before you begin using the XTP in your InfoPath forms; just a few modifications and tweaks and you’re ready to go!

    REQUIREMENTS

    • QdContactSelectorXTP – Contact Selector template part, no ActiveX required, no code.
    • InfoPath 2007 – template parts (XTPs) are not supported in InfoPath 2003.
    • Qdabra Database Accelerator – includes the Active Directory Web Service. Download a FREE trial here. Alternatively, you may purchase Qdabra’s Active Directory Standalone tool here.
    • Qdabra qRules  – add the most commonly requested InfoPath features without the need of writing code. Download a FREE trial here.
    • Admin-deploy to SharePoint – qRules is a library that contains code, so when you publish your form to SharePoint you need to publish it as an administrator approved form. This requirement goes away for SharePoint 2010.

    ADD THE TEMPLATE PART IN INFOPATH CUSTOM CONTROLS

    1. Launch InfoPath and select Design a Form Template based on a new blank one.

    2. In the Controls taskpane, click Add or Remove Custom Controls…

     

    3. In the Custom Controls dialog box, click Add > Template Part, and browse to the location where you placed your QdContactSelector XTP.

     

    4. Verify that the XTP has been added to your Custom Controls taskpane.

     

    5. Save your form template (XSN). For the purposes of this blog post, we will name it as ContactSelectorXSN.

    6. Close InfoPath.

    INJECT QRULES AND THE XTP

    1. Launch the qRules Injector from Start > All Programs > Qdabra > Tools > qRules Injector.

     

    2. Browse to the location where you saved your ContactSelectorXSN.

    3. Click Inject, then OK in the confirmation dialog, and then close the qRules Injector.

    4. Open ContactSelectorXSN in InfoPath Design mode.

    5. Scroll down to the very bottom of the Controls taskpane to get to the Custom section, and then click on the QdContactSelector control.

    You should now have the template part on your canvas. The main and the secondary data sources will be injected in your XSN as well.

     

    SOURCE FILES CLEAN-UP

    If you go to Tools > Data Connections, you will notice that you have two instances of QdabraRules, one for the XSN, and one for the XTP:

     

    When you first injected qRules in your XSN, it added the QdabraRules XML as a secondary data source. In this same XSN, you injected the QdContactSelector XTP which also uses qRules. This added another QdabraRules XML secondary data source to the XSN (with a different name). So now, you have two qRules XMLs, which is confusing and might cause issues when calling the qRules commands, hence the need to do some clean-up.

    1. Save ContactSelectorXSN as source files and close InfoPath.

    2. Modify the manifest.xsf file:

    a. In the directory where you saved your source files, locate manifest.xsf and open it in any text editor.

    b. Replace all seven instances of “QdabraRules_QdContactSelector” with “QdabraRules”.

    c. Delete the associated blocks where you find “QdabraRules1”:

    i. xsf:file (for .xsd)

     

    ii. xsf:file (for .xml)

     

    iii. xsf:dataObject

     

    d. Save and close manifest.xsf.

    3. Modify the sampledata.xml file

    a. Open sampledata.xml in a text editor.

    b. Delete the xd:DataConnection block where you find “QdabraRules_QdContactSelector”.

     

    c. Save and close sampledata.xml.

    4. Delete the extraneous QdabraRules1 files in the source files directory:

    a. QdabraRules1.xml

    b. QdabraRules1.xsd

    5. Verify changes.

    a. Open manifest.xsf in InfoPath Design mode.

    b. Go to Tools > Data Connections and verify that you now have only one instance of QdabraRules.

     

    MODIFY THE ACTIVE DIRECTORY DATA CONNECTION

    1. In Tools > Data Connections, modify the FindUsersByName_QdContactSelector data connection.

    2. Replace servername (in http://servername/qdabrawebservice/ADUserInfo.asmx?WSDL) with the correct location where you installed DBXL.

     

    Note: If you are using Qdabra’s AD Standalone Tool, the AD Web Service URL should be in the format: http://servername/QdabraAD/ADUserInfo.asmx?WSDL.

    3. Click Next and make sure that the FindUsersByName operation is selected. Click Next again.

    4. Leave the tns:name parameter blank, and for the tns:searchType*, select Contains.

     

    5. Click Next twice more, then Finish to exit out of the wizard.

    MODIFY THE QRULES COMMANDS

    Since you’ve added the QdContactSelector XTP into an XSN, you need to make sure that the qRules commands point to the new fields’ XPaths.

    1. Double-click on the  button to open its properties.

     

    2. Click Rules and modify all the three actions in the Insert User rule:

     

    a. Change the first action that calls the Insert command to:

    Insert /parent=/my:myFields/my:UserList /child=/my:Alias /count=1

     

    b. Change the second action that calls the SetValue command to:

    concat("SetValue /xpath=/my:myFields/my:UserList/my:Alias[last()] /value=", @value)

     

    Note: @value refers to a field in the form. If in doubt, tick the checkbox labeled Edit XPath to see the full xpath of the @value node.

    c. Do the same for the third action for the SetValue command:

    concat("SetValue /xpath=/my:myFields/my:UserList/my:Alias[last()]/@my:name /value=", @display)

     

    3. Click OK as many times needed to close all the dialog boxes.

    4. Double-click on the  button to open its properties and modify the Remove User rule.

     

    In the Insert Formula dialog, check on the Edit XPath (advanced) box and change the Delete command to:

    concat("Delete /xpath=/my:myFields/my:UserList/my:Alias[", count(preceding-sibling::my:Alias) + 1, "]")

     

    5. Click OK until all dialog boxes are closed.

    6. Add conditional formatting so that, when users have already selected a contact, they can no longer add the same contact.

    a. Double-click on the  button to open its properties.

    b. Go to the Display tab > Conditional Formatting > Add.

    c. Add a condition such that if Alias (from the main data source):

     

    is equal to the value node (from the FindUsersByName_QdContactSelector secondary data source):

     

    then hide the control:

     

    d. Click OK until all the dialog boxes are closed.

    e. Do the same for the @display field. Double-click on the textbox to open its properties.

     

    f. Go to the Display tab > Conditional Formatting > Add.

    g. Add a condition such that if Alias (from the main data source) is equal to the value node (from the FindUsersByName_QdContactSelector secondary data source), then change the font color to something lighter:

     

    h. Click OK until all the dialog boxes are closed.

    That’s it! You’re all set to use Qdabra’s Zero-ActiveX Contact Selector! Test your XSN in Preview mode and search for users, select contacts and even delete them. Finish designing your form template, save it, and you’re ready to go!

    PUBLISH TO SHAREPOINT

    Here’s a link to an article describing how to publish your new form to SharePoint so you can use it in the browser.

    You can also refer to the User Guide that comes with your qRules v2.0 installation for instructions on how to use your qRules solutions in InfoPath Forms Services.

  • Copy SharePoint List Data to Main Data Source

    This post was originally written by Clay Cobb and is republished here with permission. To see the original article, please click here.

    One thing that you can't easily do in InfoPath is to copy repeating data from a secondary data source - like a SharePoint list - to the main data source. This is an important necessity, because the data from secondary data connections does not get saved in the resulting XML data file of a submitted/saved InfoPath form. So, when you look at the form initially, you see the nice pretty data from your SharePoint list enumerated within the repeating table you placed on the canvas, but if you were to open the raw XML file, none of that data would be there. This is because an InfoPath form only keeps whatever data is saved to its main data source. A data connection to a SharePoint list is just a secondary data connection, which in essence becomes a window into the data as it currently exists. Yes, you can re-open your XML file in InfoPath and see the data from your SharePoint list, but it's the current instance of that data, not the data that existed at the time you previously submitted the form. Sometimes, this is ok, but what if you needed to get that SharePoint data into your form and keep it there? To do this, you must copy the data into the main data source. How can you do that? Well, you can custom code something, or you can use the great set of special commands known as qRules that is provided to all of us by Qdabra. qRules allows you to do many things, but the one command we will focus on is named CopyTable.

    Caveats:

    • qRules introduces code to your form, so if your forms are browser-enabled, then they will require Full Trust and Administrative-Approval publishing type. I have not tested any in browser forms yet
    • The CopyTable command will only work if the nodes match, which also means each node has to have data in it (no blank fields). The reason your fields can’t be blank is because when there is a blank field, no placeholder for that field is brought down in the XML, so it’s as if that node doesn’t exist.

    The example I will use for this blog is a Weekly Status form template (based off the Meeting Agenda sample) within a Meeting Workspace where you pull in Active Tasks from a SharePoint Task List on demand so that a snapshot of the tasks is saved within the form. The purpose of this is so that at a later time, the Weekly Status for that week's meeting can be opened, and you will see the status of the team's tasks when the meeting occurred rather than the current point in time. In essence, it becomes an historical record of the team's tasks just like meeting minutes are intended to be. For the purposes of this blog, I will not go into great detail about meeting workspaces and how they work, but I will briefly explain how InfoPath forms need to be used in order to get the recurring meeting functionality. Here are the steps to accomplish the goal:

    1. Create Tasks List (covered in minimal detail)
    2. Create Meeting Workspace with a Form Library (covered in minimal detail)
    3. Create Form Template
    4. Install qRules and Inject Form
    5. Apply CopyTable Command Rule
    6. Publish the Form and Verify Success

    Create Tasks List

    • Create a simple tasks list.
    • Add some tasks with a variety of statuses, priorities, and due dates (Fig 1).

    Figure01 

    Fig 1 - Basic tasks list with several tasks added

    • Take note that the Active Tasks built-in view only shows tasks that are not completed (Fig 2).

    Figure02 

    Fig 2 - Active Tasks view only shows incomplete tasks

    • Set Active Tasks view as Default View.

    Create Meeting Workspace

    • Create a Basic Meeting Workspace with Recurrence (I prefer to use Outlook 2007 to create my recurring meeting, and then I use the integrated Meeting Workspace feature button to provision my site in SharePoint - Fig 3).

    Figure03 

    Fig 3 - Creation of Meeting Workspace in Outlook 2007

    • Edit the default page of your new Meeting Workspace and close the default web parts (unless you prefer to use one or many later).
    • Create Form Library and be sure to NOT click Yes for "Change items into series items" (Fig 4). If we do that, then all forms show on every meeting page (each recurring date). If we leave this as No, then only the relevant form for that meeting will display each week.

    Figure04 

    Fig 4 - Form library within a Meeting Workspace - not a series item

    • This will put your new Weekly Status form library on the default page for each recurring meeting within this workspace (Fig 5).

    Figure05 

    Fig 5 - View of default Meeting Workspace page showing the current week

    Create Form Template

    • Create new template based on built-in sample Meeting Agenda template and modify to your preference (Fig 6).

    Figure06 

    Fig 6 - Weekly Status form template

    • Create a Receive data connection to the Team Tasks SharePoint list, but set it NOT to "Automatically retrieve data when form is opened" (Fig 7). Be sure to choose only the fields you want to ultimately see in the form, because this will play a big part in our CopyTable command.

    Figure07 

    Fig 7 - Tasks data connection with automatic retrieval check box de-selected

    • Create data structure in form template that exactly matches the data structure of the SharePoint data connection. Your SharePoint Tasks list data connection will include whatever fields you selected during the creation of the data connection from step 2. Simply go to the Data Source pain in InfoPath and choose your "Tasks (Secondary)" data source. Drill down until you get to the nodes. You will notice that the fields within the Tasks repeating group are attributes and not elements (this is important). *Note: You can also see the raw data structure by clicking Save As Source Files and opening your Tasks.xsd file in notepad. Now, go back to your main data source and add a new non-repeating group (aka Table) that includes the Tasks repeating group (aka Row) and all the attribute fields (Columns). Be sure that the field names and data types match exactly for the attribute fields (Fig 8 ).

    Figure08 

    Fig 8 - Tasks node structure in main data source matching SharePoint secondary data source

    • Drag repeating Tasks group from Main data source onto the canvas as a repeating table and configure the columns/fields (Fig 9).
      • Stretch and shrink the columns so that the data will display properly
      • Change the Complete column header to %
      • Change the % field control format to show Percentage with ndecimal places
      • Change the Due Date field control to a Date Picker (optional)
      • You'll also probably want all of these to be read-only fields. *Note: To make a Date Picker control Read-Only, you set conditional formatting on it that says, “If Due_Date is present, then make control Read-Only."

    Figure09 

    Fig 9 - Tasks Main data source repeating table with formatting

    Install qRules and Inject Form

    • After installing qRules, you will see that it does far more than CopyTable, but those other commands will be the subject of future blogs. You can also get previously-written explanations and discussions related to qRules here.
    • After a successful install, Inject qRules into the form template (Fig 10)

    Figure10 

    Fig 10 - Injecting form template with qRules

    Apply CopyTable Command Rule

    • Create button for retrieving Active Tasks on demand and for performing the CopyTable qRules (Fig 11)
      • Simply drag a Button to the canvas and change the label to something like Show Active Tasks
      • Click the Rules button and Add a rule named something like Query Tasks and Copy
      • Add an Action that Queries using the Tasks data connection
      • Add an Action that Set's a Field's Value, choose the Command node from the QdabraRules (Secondary) data source, and set the value to this command string:
        CopyTable /dsnamesrc=Tasks /tablesrc=/dfs:myFields/dfs:dataFields /rowsrc=dfs:Tasks
        /tabledest=my:meetingAgenda/my:Task /rowdest=my:Tasks /empty=yes
        • KEY NOTE!! Do not try to paste your command string into the function builder (fx button). Just paste it directly into the Value field.
        • dsnamesrc: This is the name of your source data connection, which is named Tasks in our example. Remember that this could be different if you apply this elsewhere, so be sure to use the proper name for this attribute
        • tablesrc: This is the table within your data source that provides the data. You need to properly type in the hierarchy from the Tasks secondary data connection using the information you found in Figure 8. Notice that the namespace for a SharePoint list is DFS and not MY.
        • rowsrc: This is the repeating group that includes the nodes from your SharePoint data connection. Mine is Team_Tasks, but if you use the default Tasks list from a Team Site, this would just be dfs:Tasks.
        • dsnamedest: This is not shown, because it defaults to the main data source, but if you needed to copy your data to another secondary data source, you would provide the name of that data connection here.
        • tabledest: Like tablesrc, this is the table that will receive the data. This uses the structure we created in our main data source in Figure 8. Notice the default namespace for an InfoPath form is MY, and then my data source root is meetingAgenda due to using the Meeting Agenda sample template.
        • rowdest: This is the repeating group where we want to send the data
        • empty: This is a field that accepts a yes/no flag based on whether you want to first erase all existing data first from the destination table or not.

    Figure11 

    Fig 11 - Custom button that queries the SharePoint list and performs the CopyTable command

    • Preview the form and click the button to verify that there are no errors and that your repeating table populates with the Active Tasks only (Fig 12).

    Figure12 

    Fig 12 - Repeating table in main data source showing Active Tasks

    Publish the Form and Verify Success

    • Publish the form, go to your Meeting Workspace, and click New in the form library
    • Fill out the form as much as you want
    • Click the Show Active Tasks button, ensure it populates the table, and then click Save to save the form back to the library
    • When you see the XML form in the library, click on it and verify that you still see the data
    • Close the form, then go change an active task to mark it as completed so that it doesn't show up in our Active Tasks view (Fig 13/14)

    Figure13 

    Figure14 

    Fig 13/14 – CopyTable task complete and no longer active

    • Re-open your existing form (Fig 15) and notice that you still see the previous data (3 tasks, not 2). This is the desired behavior, because we want to know the status of our Active Tasks at the time of the meeting, not later after the meeting when we re-open the form. If we were only showing the secondary data source, then we would always see the current Active Tasks, which is not desired. If you were to click the button again, then it would update with the new tasks, but that is not the intent here (feel free to apply conditional formatting to hide the button after it is saved). You would only hit the button on new forms when conducting future meetings.

    Figure15 

    Fig 15 – Final view of completed form

    • Another point of note is that we aren't using the Auto-Generating Filenames for InfoPath Forms concept, because if you use submit in a Meeting Workspace, then it saves the XML form to the root of the form library, which then makes it not visible to any of the recurring meeting dates. Using save allows it to save to its respective meeting (Fig 16) date and thus only see one form per meeting and ensuring that you only see the snapshot of active tasks at that given date.

    Figure16 

    Fig 16 – Saved form shows up in proper meeting date

  • Qdabra Vertical Tabs Template Part

    This blog post provides the steps on how to create an InfoPath form that switches views through vertical tabs. When you’ve followed all those steps and have successfully created your own InfoPath form with vertical tabs, you’ll probably use this technique when designing your forms going forward. It’ll be more cool to have a template part that’s readily available from your InfoPath Custom Controls so you can easily add vertical tabs in your forms.

    Qdabra has packaged this template part for you so you can add vertical tabs in your InfoPath solutions anytime, in as many form templates as you want, in a single click!

    And not only that!

    We’re aware that template parts don’t inherit the color scheme of its destination form. Instead, your template part section will remain to have the default, not-so-exciting Blue theme, when everything else in your form is gray, or burgundy, purple, or what have you. If you wish to change the vertical tabs’ color scheme to match your entire form’s, you will have to edit the styles in each of your layout tables and controls, or worse, tinker with the XSL files and hand-edit them.

    Qdabra’s Vertical Tabs XTP is designed to acquire color schemes. We’ve done it all for you!

    So if I want the Gray theme:

    or Burgundy:

    or the Purple Sage theme:

    I can pick whichever in a single click.

    Cool, eh?

    The Vertical Tabs package includes the template part (XTP), along with a user guide and a sample InfoPath form template (XSN) to get you started. Click here to purchase the package.

  • Create an InfoPath form that switches views

    We’ve seen InfoPath forms that have tabs on top, lined up horizontally. These tabs are actually buttons that are meant for switching to different views within the form.

    This blog post describes how this is done:

    For a change, why don’t we have these tabs lined up vertically instead, like this:

    Nice?

    Follow the steps below to find out how this is done.

    1. Design a new, blank InfoPath form template.

    2. Insert a table with at least 6 columns and 1 row.

    3. Merge the first 5 columns:

    The left column will hold your form template’s fields and controls, while the right is where your vertical tabs will go.

    4. Insert at least 4 buttons in the right column, labelling each as Tab 1, Tab 2, Tab 3 and Tab 4, and with IDs tabOne, tabTwo, tabThree and tabFour, respectively.

    5. Right-click on the cell where the buttons are > Table Properties > Cell and make all paddings 0px:

    6. Add three more views in your form template named View 2, View 3 and View 4:

    7. Save your form template as source files:

    8. Close InfoPath.

    9. Modify the .xsl files

    a. In the directory where you saved your source files, open all the .xsl files in any text editor such as Notepad.

    b. In view1.xsl, search for “<body style

     

    The section above represents the entire content of your first view which we will copy onto our other views so that they’d all look similar.

    c. In view1.xsl, copy the entire section shown above and paste it onto the other three views replacing this part:

     

    d. This section represents your vertical tabs/buttons:

     

    Note that for each view, we will have a different style for the button corresponding to that view, i.e. the “active” view. For example, the first view (View 1) will have the first button (Tab 1) as the active view button, while the rest will have non-active view buttons.

    For your active view, insert the following for the active button:

    style="BORDER-RIGHT: #000000 1pt solid; PADDING-RIGHT: 10px; BORDER-TOP: #000000 1pt solid; FONT-WEIGHT: bold; PADDING-BOTTOM: 7px; MARGIN: 4px 0px 0px; BORDER-LEFT: #1e3c7b 2.25pt solid; WIDTH: 100%; COLOR: #ffffff; PADDING-TOP: 7px; BORDER-BOTTOM: #000000 1pt solid; BACKGROUND-COLOR: #517dbf; TEXT-ALIGN: right"

    And for the non-active ones, insert the following:

    style="BORDER-RIGHT: #000000 1pt solid; BORDER-TOP: #000000 1pt solid; PADDING-LEFT: 7px; PADDING-BOTTOM: 3px; MARGIN: 4px 10px 0px 0px; BORDER-LEFT: #c0c0c0 2.25pt solid; WIDTH: 100%; COLOR: #517dbf; PADDING-TOP: 3px; BORDER-BOTTOM: #000000 1pt solid; BACKGROUND-COLOR: #ebf0f9; TEXT-ALIGN: left"

    You will then have the following for view1.xsl:

     

    e. Repeat the same process for the remaining views (.xsl files), inserting the active style tags for the corresponding view, and the non-active ones for the others.

    f. When done, save all your .xsl files.

    10. Right-click on manifest.xsf and click Design to see the results in InfoPath design mode.

    11. In all the views, add rules to all the buttons (except for the button corresponding to the current view) that switches to the other views:

    a. View 1:

    i. Double-click on the Tab 2 button to open its properties, click Rules > Add > Add Action > Switch View > View 2.

    ii. Double-click on the Tab 3 button to open its properties, click Rules > Add > Add Action > Switch View > View 3.

    iii. Double-click on the Tab 4 button to open its properties, click Rules > Add > Add Action > Switch View > View 4.

    b. View 2:

    i. Double-click on the Tab 1 button to open its properties, click Rules > Add > Add Action > Switch View > View 1.

    ii. Double-click on the Tab 3 button to open its properties, click Rules > Add > Add Action > Switch View > View 3.

    iii. Double-click on the Tab 4 button to open its properties, click Rules > Add > Add Action > Switch View > View 4.

    c. View 3:

    i. Double-click on the Tab 1 button to open its properties, click Rules > Add > Add Action > Switch View > View 1.

    ii. Double-click on the Tab 2 button to open its properties, click Rules > Add > Add Action > Switch View > View 2.

    iii. Double-click on the Tab 4 button to open its properties, click Rules > Add > Add Action > Switch View > View 4.

    d. View 4:

    i. Double-click on the Tab 1 button to open its properties, click Rules > Add > Add Action > Switch View > View 1.

    ii. Double-click on the Tab 2 button to open its properties, click Rules > Add > Add Action > Switch View > View 2.

    iii. Double-click on the Tab 3 button to open its properties, click Rules > Add > Add Action > Switch View > View 3.

    You can now design your views according to your needs. Add your titles, fields/controls, borders and shading, etc…

    There’s your vertical tabbing!

    When you’ve done all the steps in this blog and have successfully created your own InfoPath form with vertical tabs, you’ll probably use this technique when designing your forms going forward. It’ll be more cool to have a template part that’s readily available from your InfoPath Custom Controls so you can add vertical tabs in your forms in one click! Click here to learn more.

  • Add a repeating Electronic Signature template part

    Qdabra’s Electronic Signature template part allows you to add signature images into your InfoPath solutions. This blog post describes Qdabra’s Electronic Signature template part in full detail. If you have not learned about this XTP, please read that blog post before continuing.

    There may be times when we want multiple users to electronically sign a single InfoPath form, hence making the template part section repeating. This blog post details the steps on how to create a sample InfoPath form with a repeating Electronic Signature template part.

    1. Design a new, blank InfoPath form template.

    2. In your Data Source taskpane, add a repeating group called RepeatingES and drag it onto your view.

    3. Place your cursor inside the RepeatingES repeating section.

    4. Switch over to your Controls task pane and select your Electronic Signature template part.

    Your form template should look similar to this: 

    5. Modify your Validate check box rules.

    a. Double-click on the Validate check box to open its properties, and then click Rules.

    b. Modify the Valid rule’s condition:

    i. In the Rules dialog box, select Valid and click Modify

    ii. In the Valid rule dialog, click Set Condition

    iii. In the Condition dialog’s first drop down box, select “The expression”. 

    iv. Paste the following custom XPath inside the text box:

    ../my:UserInfo/my:PIN = xdXDocument:GetDOM("PIN List_ElectronicSignature")/dfs:myFields/dfs:dataFields/dfs:Pin_List/@PIN[../@Title = current()/../my:UserInfo/my:UserName] 

    v. Click OK twice to return to the Rules dialog.

    c. Modify the Invalid rule’s conditions:

    i. In the Rules dialog box, select Invalid and click Modify

    ii. In the Invalid rule dialog, click Set Condition

    iii. In the Condition dialog’s first drop down box, select “The expression”. 

    iv. Paste the following custom XPath inside the text box:

    ../my:UserInfo/my:PIN != xdXDocument:GetDOM("PIN List_ElectronicSignature")/dfs:myFields/dfs:dataFields/dfs:Pin_List/@PIN[../@Title = current()/../my:UserInfo/my:UserName]

    v. Change the second condition’s first drop down value to “The expression” and paste the following custom XPath:

    ../my:UserInfo/my:UserName != xdXDocument:GetDOM("PIN List_ElectronicSignature")/dfs:myFields/dfs:dataFields/dfs:Pin_List/@Title[../@PIN = current()/../my:UserInfo/my:PIN]

    vi. Add a third “OR” condition using the expression:

    ../my:UserInfo/my:UserName != xdXDocument:GetDOM("PIN List_ElectronicSignature")/dfs:myFields/dfs:dataFields/dfs:Pin_List/@Title

    This new third condition is required for cases when neither the UserName nor the PIN are found in the list, otherwise no error is returned.

    Your Invalid rule’s Condition dialog should look similar to this: 

    vii. Click OK until all the dialogs are closed.

    6. Finally, test your form template in Preview mode. 

    After testing that all the validation works as expected, you can then publish your solution to your SharePoint site.

  • Configure the Electronic Signature template part to work in browser-enabled forms

    Qdabra’s Electronic Signature template part features the ability to add signature images into your InfoPath solutions. These can be scanned-in signatures that are saved as images and are stored in a SharePoint picture library. This blog post describes Qdabra’s Electronic Signature template part in full detail. If you have not learned about this XTP, please read that blog post before continuing.

    Many organizations find this template part useful, but how about those that that use browser-enabled forms? We know that images are not allowed in form templates that are designed for InfoPath Forms Services (IPFS). But there is a way to use electronic signatures! With a little tweaking and modifying, we can get that template part to work in your browser-enabled forms. Here’s how:

    1. Open the Electronic Signature template part (qESxtp) in InfoPath Design mode. 

    2. Go to File > Save As and give it a different name such as qESxtp-Web.

    3. Delete all unneeded data connection and fields.

    a. In Tools > Data Connections, delete the connection that retrieves images from your SharePoint picture library. (You may have named it “Verify PIN”.)

    b. From your main data source, delete the LibraryURL field: /my:qESxtp/my:UserInfo/my:LibraryURL.

    c. Delete the Signature field: /my:qESxtp/my:Sign/my:Signature. Remove the Picture control in your view as well.

    Your template part should now look similar to this: 

    4. Change the default value of the DisplaySignedBy field: /my:qESxtp/my:Sign/my:DisplaySignedBy

    a. In your Main data source task pane, right click on the DisplaySignedBy field and select Properties.

    b. Click on the fx icon next to the Value textbox: 

    c. In the Insert Formula dialog, delete the XPath that previously referred to your SharePoint picture library: 

    d. Click on the Insert Field or Group button.

    e. Switch over to your PIN List (Secondary) data source, expand dataFields > PinList, then select Title

    f. Click on the Filter Data button, then click Add.

    g. Add a filter such that the Title from your SharePoint list is equal to the UserName in your main data source, i.e. /dfs:myFields/dfs:dataFields/dfs:PinList/@Title is equal to /my:qESxtp/my:UserInfo/my:UserName

    h. Click OK.

    Your new formula for the DisplaySignedBy field should be similar to this: 

    i. Click OK to close all the dialogs.

    5. In your validation rule, delete the action that previously referred to the Signature field.

    a. Double-click on the Validate checkbox to open its properties.

    b. Click on Rules and modify the Valid rule.

    c. Click on the second action from the list: 

    d. Click on the Remove button.

    You should now be left with two actions in your Valid rule: 

    e. Click OK to close the dialog box.

    6. Add a condition to display an error if the user enters a Name that does not exist in the SharePoint list:

    a. Still in the Rules dialog of your Validate checkbox, modify the Invalid rule.

    b. Click on the Set Condition button.

    c. Modify the second condition that previously referred to the Signature field:

    i. Click on the first drop-down box, then click Select a field or group

    ii. From your Main data source, select the UserName field, then click OK

    iii. Change the second drop-down selection to is not equal to: 

    iv. Click on the third drop-down box then select Use a formula.

    v. In the Insert Formula dialog, click on the Insert Field or Group button.

    vi. Switch over to your PIN List (Secondary) data source, expand dataFields > PinList, then select Title

    vii. Click on the Filter Data button, then click Add.

    viii. Add a filter such that the PIN from your SharePoint list is equal to the PIN in your main data source, i.e. /dfs:myFields/dfs:dataFields/dfs:PinList/@PIN is equal to /my:qESxtp/my:UserInfo/my:PIN 

    ix. Click OK four times to go back to the Condition dialog box.

    Your second condition for the Invalid rule should look like this: 

    x. Click OK three times to return to the Validate check box properties window.

    7. Remove the conditional formatting for the Validate check box that previously referred to the Signature field:

    a. In the Validate check box properties dialog, click on the Display tab.

    b. Click on the Conditional Formatting button and modify the existing condition. 

    c. Click on the Remove button in the first condition.

    You should now have only one conditional formatting in your Validate check box: 

    d. Click OK to close all the dialogs.

    8. Change the conditional formatting for the UserInfo section that previously referred to the Signature field.

    a. Double-click on the UserInfo section and select Conditional Formatting

    b. Remove the existing condition: 

    c. Add two new conditions that hide the control when:

    i. Validate is equal to TRUE; and:

    ii. DisplayError is equal to FALSE 

    d. Click OK until all the dialogs are closed.

    9. Finally, save your template part.


    Remember that you would need to remove the old Electronic Signature template part in your InfoPath Custom controls and then add the latest version. You can then update your existing browser-enabled forms with the new version.

More Posts « Previous page - Next page »
Copyright © 2003-2018 Qdabra Software. All rights reserved.
View our Terms of Use.