Mel Balsamo
in

InfoPath Dev

This Blog

Syndication

Mel Balsamo

  • Get rid of that "Control binding is not supported" error on your Design Checker!

    Got calculated values on your InfoPath browser form? Do they involve filters and/or complex formulas? Surprised to find out that as soon as you're ready to publish your form, there goes the Design Checker error on the taskpane --- "Control binding is not supported"

    Hilary, one of our InfoPath experts, blogged something about this - here's her post. She suggested a workaround of manually modifying the form source files which wondefully works. Her readers asked if there's a way to do this without tinkering with the source - there is indeed! And it is easy... read on!

    To reproduce the scenario and better understand when this issue actually occurs, create a simple form by following these steps:

    1. Add a repeating table with 2 columns.
    2. Add a calculated value control and set it to display the repeating group's field1 node - we know that this will display only the first row's field1 value, but we won't care about that for now.
    3. Go to File > Design Checker --- no errors, good! Not surprising, but good.
    4. Add another calculated value control - the value this time will be the field1 node filtered when field2 is not blank. So you'd select Calculated Value from the Controls menu > click on the fx button > Insert Field or Group > select field1 > Filter Data > Add > field2 is not blank > click OK five times.

      Here's what we have so far:

      Let's preview the form to make sure it's working so far...


    5. Close Preview and click Refresh on the Design Checker pane - still no error...

      And here's where we try reproducing the issue - we'll make that design checker error appear...

    6. Right-click on the first calculated value's control and select Calculated Value Properties > click on the fx button and just click OK twice to close it without changing anything - just humor me here, ok? Now click Refresh again - no error.
    7. Repeat the same actions on Step 6, this time with the second calculated value --- so look at the formula in the properties dialog box, don't change anything and hit OK to close it.

    Click Refresh --- bam! There's your error.

    At this point, we'll wonder - is it a bug in InfoPath? I don't know. But here's where I think Hilary's observation comes to play - it might've already added that "xd:binding" attribute in the xsl file as soon as we clicked OK, InfoPath thinking that we "modified" it. If you Undo once from that last step and refresh again, the error will go away. But who can keep track? (Note to self: don't click OK in edit mode dialogs when I really did not change anything - there's a Cancel button after all!)

    The solution, aside from manually modifying the source files, is to ---- delete the calculated value and add a fresh one! Yes! But before you delete, make sure to grab your formula first - copy it, so that you won't need to rebuild it on your fresh calculated value as you can just paste the expression in the formula box. Now that's easy enough, at least for me.

    So we know that this will occur everytime you'd go to the formula and edit it (what a pain). Again, who can keep track? The goodness left in this is that InfoPath will still be friendly enough to point all instances of this error when it's time to publish your form. So keep working, just keep adding your calculated values, modify them all you want. When you publish, you'd end up with 10 or more errors like this, but when you click on each, your cursor will point to the exact calculated value that needs to be recreated. You can then fix them all at once.

    Hope this helps...

  • Add a dog ear to your form

    From this:

     

    To this:

     

    That looks like a "dog ear" to me, pretty much.

    Adding this requires a little knowledge with Adobe Photoshop, but the steps should be straight-forward. So, if you're ready – grab the PSD file here.

    1. Open QdHeader.psd in Adobe Photoshop.

    2. From the Layers pane, select Corner.

     

    This will select the "dog ear" image from the canvas.

     

    3. From the vertical toolbar menu, set the foreground color to your desired border color – let's pick red for this example.

     

    4. Select the paint bucket tool.

     

    5. Click the border portion of the dog ear to color it.

       

    6. Repeat the same steps for the right, left and top borders, selecting the layer first and then using the paint bucket tool to change the color.

    7. You can change the remaining yellow-colored portion of the "dog ear" to match your form view's background color, like so

     

    8. You can also change the gradient overlay color to match your desired theme:

     

    9. Finally, add your company logo, slogan, etc. to add branding to your form.

     

    10. That's it! You can just save the file as an image and add it to your form.

    You should now have a very neat header for use in all your forms. Enjoy!

  • Show unique rows in a secondary repeating data source table - no code!

    When designing an InfoPath form that integrates with a secondary data source such as a SharePoint list, data retrieved from SQL, or a simple XML document – you may find yourself needing to hide rows that have the same value/s as that in your main data source.

    There might already be written blogs out there demonstrating techniques on how to do this such as Greg’s and Matt’s – both show different techniques on how to filter a dropdown list showing only unique selections; but I haven’t been able to find an exact article on how to hide the entire row in a repeating table coming from my secondary data source itself.

    In a recent project, I’ve used a technique that does just this and it really is so simple so it might be worth a share. Oh, and take note --- this works like a charm using just one conditional formatting, no code at all! Interested? Follow along…

    To simulate the scenario, let’s create an XML document that lists some fruits:

    <?xml version="1.0" encoding="UTF-8"?>

    <items>
        <item>Apple</item>
        <item>Banana</item>
        <item>Orange</item>
        <item>Lemon</item>
        <item>Kiwi</item>
    </items>

    We’ll use this as our secondary data source. Save it as an XML file.

    We’ll then design a simple InfoPath form template, adding the XML file as a secondary receive data connection that automatically retrieves data on form open – we’ll call it “Fruits”.

    image

    This should be displayed in the Fields task pane like so:

    image

    And then we’ll add the main data source:

    image

    Next, drag the main data source Item group as a repeating table on the canvas, as well as the item repeating group from the XML secondary data source – add headings to differentiate the two sources, like so:

    image

    We’ll now add the key ingredient!

    First, select the item repeating group from Fruits (Secondary) data source – this is where we’ll add the conditional formatting. Display the Rules by clicking Manage Rules under the Home tab and once displayed, click New > Formatting.

    On the Condition window, leave the first and the second dropdown selections to the item field of the Fruits (Secondary) data source and as “is equal to”, respectively; then on the third dropdown, choose “Select a field or group…”

    SNAGHTML11c3da06

    Select the Fruit field from the main data source.

    image

    Click OK as many times needed to close all dialog boxes and then check the Hide this control box. Your conditional formatting rule should look similar to this:

    image

    And now, the fun part – testing your form! On preview mode, it should look like this:

    image

    Begin inserting item/s in the main data source and see for yourself, how simple it is to hide those secondary data source rows that has matching values in the main data source!

    image

    Have I mentioned it’s simple? Smile

  • How to Create a Digital Certificate and Publish a Signed Template to the DBXL Admin Tool

    Because InfoPath 2010 digital certificates are only good for a month, we will use the Digital Certificate for VBA Projects tool to create one that will last several years. You could also use InfoPath 2007 or 2003 (if available) as these both produce digital certificates that last many years. Your safest route for production is to get your digital certificate from a Certificate Authority.

    Create a Digital Certificate

    To create a digital certificate:

    1.       Open the Windows Start Menu.

    2.       Navigate to All Programs | Microsoft Office | Microsoft Office Tools.

    3.       Click Digital Certificate for VBA Projects.

    4.       In the Create Digital Certificate dialog box, type InfoPath Certificate, and then click OK.

    clip_image001

    Publish a Signed Template to the DBXL Admin Tool

    Publish an unsigned template using the following steps:

    1.       Publish an unsigned template from the InfoPath designer (we’ll sign it at a later step).

    2.       Launch the DBXL Admin Tool (DAT).

    3.       Create or edit the Document Type Configuration for your template.

    4.       Attach your InfoPath template, and ensure to clear the check box labeled Form Template Is Signed.

    clip_image002

    5.       Save your Document Type.

    6.       Click OK when the Changes Saved message appears.

    Save and sign your template using the following steps:

    1.       Right-click the saved XSN file and choose Save As.
    NOTE: Be sure the file extension is present (i.e. it you should be saving “My InfoPath Template.xsn” and not “My InfoPath Template”).

    2.       Choose a location to save your unsigned published template, and then click Save.

    3.       Locate and right-click your saved form, and choose Design.

    4.       On the File tab, click Form Options.

    clip_image003

    5.       Select Security And Trust in the Category list.

    6.       Clear the check box labeled Automatically Determine Security Level, and then choose Full Trust.

    7.       Select the check box labeled Sign This Form Template, and then click Select Certificate.

    8.       Select the InfoPath Certificate you created earlier, and then click OK.

    clip_image005 

    9.       Click OK.

    10.   Save (not publish) your signed form (overwrite previous template or save as with new name).

    Republish your signed form using the following steps:

    1.       In the DAT, you should still be editing your Document Type.

    2.       Right-click the XSN File, and choose Attach.

    3.       Locate and select your signed template, and then click Open.

    4.       Select the check box labeled Form Template Is Signed.

    5.       Click Save.

    clip_image006 

    Install the Digital Certificate

    A. If you are the user who created this digital certificate and this is the first time you are opening a form template that uses it:

    1.       Click the green-arrow download button to launch the form template.

    2.       If prompted, click Open:

    clip_image007

    3.       When presented with the certificate dialog, click Trust All Documents From This Publisher.

    clip_image008

     

    B. If you are a user other than the one who created the digital certificate and this is the first time you are opening a form template that uses it:

    1.       Open the form from the DAT (not the DBXL Dashboard).

    2.       If prompted, click Open:

    clip_image007[1]

    3.       When presented with the certificate dialog, the Trust All Documents From This Publisher button is grayed out. Click the Show Signature Details link.

    clip_image009

    4.       On the Digital Signature Details dialog box, click View Certificate.

    5.       On the Certificate dialog box, click Install Certificate.

    6.       In the Certificate Import Wizard, click Next.

    7.       Select Place All Certificates In The Following Store, click Browse, select Trusted Root Certification Authorities, and then click OK.

    clip_image010

    8.       Click Next, and then click Finish. 

    9.       On the Security Warning dialog box, click Yes, and then click OK to the successful import message.

    clip_image011

    10.   Click OK, then OK, and then click Open.

    11.   Now close the InfoPath form template and reopen it. You will once again be presented with the InfoPath Editor Security Notice, but this time click Trust All Documents From This Publisher.

    clip_image012

  • How to Use Report Builder to Build Queries and Retrieve Data from DBXL

    “Would you like to create detailed reports from your XML data without going to the trouble of creating a database mapping? With DBXL v2.5 and Report Builder, now you can.”

    In this blog post, I’ll detail the steps on how to do simple XML reporting in your forms, using DBXL’s QueryDocumentsNodeSet and the Report Builder tool:

            Extract data from your InfoPath forms even if you don’t have a database mapping

            Build your queries using DBXL v2.5’s Report Builder tool

            Export the results to Excel for pivoting and charting

    Publish a sample InfoPath form to DBXL

    1.       Download the sample InfoPath form template (CompanyContactInfo.xsn) – this is a simple InfoPath form that has a few fields and allows submit to DBXL via the SubmitDocument operation.

    2.       Open the form template in InfoPath Designer.

    3.       Go to File > Save As and save the XSN locally.

    4.       Launch the DBXL Administration Tool (DAT) from your local Database Accelerator Control Panel (the access URL would typically be in the format http://localhost:8000/QdabraWebService/default.htm).

    5.       Create a new document type configuration – give it a descriptive name and then attach your XSN. When done, click Save.

    image

    6.       Click on the Open link to open a new form using the template. Fill out and submit at least three to four documents.

    image

    Build your queries using the Report Builder tool

    7.       Download the Report Builder tool via this link.

    8.       To install, first make sure that InfoPath is not running (close all active InfoPath windows); run a command prompt as an administrator, change the directory to the location of your installation files, and then execute install.js

    image

    9.       Launch the tool by opening InfoPath, clicking New and selecting Qdabra Report Builder listed under the Installed Forms section.

    image

    10.   In the General section of the Report Builder tool, enter the Web Service URL Prefix, e.g. http://localhost:8000.

    11.   Enter QdabraWebService as the Web Service Name and then click Connect.

    image

    12.   Start building your query by clicking Add Query > Create in the Queries table.

    image

    13.   Select the document type you created in Step 5.

    image

    14.   Click on the Schema icon (image) – this will display the custom task pane at the right, double-click on the root node which in our sample XSN is  /my:myFields.

    15.   Click Insert Item and start adding the fields you wish to retrieve. Give each field an alias which will be the label/title in the Excel report for that particular field/column. Note that we can’t use spaces in aliases.

    image

    Notice the Query XML section – here, you’ll see the query string we’ll be using to retrieve the data using DBXL web service QueryDocumentsNodeSet operation later on. Copy this string and paste it in Notepad for now.

    16.   Click Perform Query – you’ll be taken to the Query All tab, click on the left arrow key (image) to expand and see the query result, like such:

    image

    You can click on the Export All Queries to Excel should you wish to use the data in Excel and do reporting.

    image

    Use QueryDocumentsNodeSet to auto-populate dropdowns

    We can now use the DBXL’s web service method called QueryDocumentsNodeSet to retrieve data in a form from another form.

    17.   In InfoPath Designer, create a new blank form.

    18.   Go to Data > Data Connections > Add and add a data connection that retrieves data from a SOAP Web service.

    19.   The URL to the DBXL Document Service would be in the format: http://<DBXLServer>/QdabraWebService/DbxlDocumentService.asmx, where <DBXLServer> is the machine where DBXL is installed (in this case, your local machine):

    image

    20.   Select QueryDocumentsNodeSet from the list of operations.

    image

    21.   Set Sample Value of the tns:query parameter to the query string generated by Report Builder – remember that you’ve pasted this in Notepad earlier.

    image

    22.   Click Next twice; give the data connection a descriptive name and then uncheck the box ‘Automatically retrieve data when form is opened’.

    image

    23.   Click Finish > Close to exit out of the Data Connections wizard.

    24.   In the Fields task pane, add a new field called Company – display this on the canvas in a dropdown list box control, like so:

    image

    25.   Right-click on the dropdown and select Drop-Down List Box Properties.

    26.   Change the List box choices selection to Get choices from an external data source. The data source will default to the one you just added.

    27.   Click on the icon next to Entries and then expand the nodes until you see the Company node – select that.

    image

    28.   You might want to check the box ‘Show only entries with unique display names’ in case you have multiple entries with the same value.

    image

    29.   Next, we’ll add form load rules that first sets the query string and then queries the data connection.

    a.       From the InfoPath Designer menu, go to Data > Form Load

    image

    b.      In the Rules task pane that appears, click New > Action > Add > Set a field’s value.

    c.       Allow the action to set the query parameter of the QueryCompanies secondary data source, to the query string generated by the Report Builder (again, you pasted this in Notepad).

    image

    d.      Add another action in the same rule that queries for data in the QueryCompanies data connection.

    image

    30.   Preview your form template – your dropdown should auto-populate with data from your DBXL doctype:

    image

    There’s your form data from another form – no database queries/mapping involved!

  • Make that repeating group display two rows per item instead of just one!

    The default Expense Report form that’s shipped with InfoPath 2007 makes use of a table that shows the expense item details per row. Your requirement is to add a new field where users can enter notes or comments for that particular expense item – you’d like to display this new field underneath the already-existing row in the table, therefore having 2 rows for each item now.

    The technique used in this blog doesn’t only apply to the Expense Report form but to all others where you’d want to show two rows per item in a repeating group, instead of just one.

    Adding a new field is easy:

    1. In your main data source, locate the items group > item repeating group and add a new field called notes (you can set it either as Text (string) data type or a Rich Text (XHTML) depending on your requirement).

     

    Your main data source should look similar to this:


    The tricky part is the layout – displaying the controls in two separate rows, and making the header/footer not repeat like how it is in a repeating table.

    To achieve the layout we want, we need to skip using a repeating table and use a repeating section instead. Follow along…

    2. Place your cursor where you want to display the section on the canvas - the Itemized Expenses layout table would probably be your pick. Don’t delete the existing repeating table just yet so you can copy/paste or drag/drop some items over later.

    3. In the Data Source taskpane, right-click on the items parent group and select Section – this will insert a section right where your cursor is on the canvas. Set this section’s padding to 0px to get rid of the unnecessary white spaces inside the section and that all its contents will stay as close to the edges as possible.


    4. With your cursor placed inside the newly-added section, go to the Table menu > Insert > Layout Table… and insert a 5 columns by 3 rows table.

    You may specify the number of columns you want depending on the fields you want to display. We’re adding 3 rows however, so we’ll have the top row for our table header, 2nd row for the repeating section that will hold the expense item details (so merge the cells to make it 1 whole row without columns), and the 3rd for the total amount of the expenses.

     

    5. Place your cursor in the second row (the one you just merged) and again, set all the paddings to 0px.


    6. Without moving your cursor where it’s at, right-click on the items repeating group and then select Repeating Section. This time, set all its paddings and margins to 0px.

     

    In InfoPath 2007, sections and repeating sections have some kind of invisible borders by default. Remove this by selecting the repeating section, and selecting None in the Borders and Shading dialog.


    Again, we’re doing all this to eliminate all the white spaces as possible in order to achieve that all-in-the-same table effect (like what a repeating table would give) even though we’re using a repeating section.

    7. With your cursor still inside the repeating section, insert a 5 columns by 2 rows table. The 1st row will hold the default details (Date, Description, Category, Cost and the arrow button) while the second is for the new notes field.

    8. Add the controls inside the table (you can drag and drop from the existing repeating table and delete it afterwards).

    Adjust the formatting to your liking – resize the cells making sure that all the columns and rows are perfectly aligned, fix the paddings and margins, add borders/shading, etc.

    Your layout might look similar to this:


    And in Preview, something like this isn’t bad at all:


    Have fun! :)

  • qRules: Videos and Documentation Links

    Posted Mar 11 2011, 06:50 AM by Mel Balsamo with no comments
    Filed under:
  • New! qRules v2.4 Form Flags Sample Form

     The qRules Form Flags sample form features the following qRules Commands:

    • IsNew - checks if form is new and sets the form version to '0'. This form version increments as changes are made to the form.
    • IsDirty - checks if the form has changed. If there are no changes and user clicks Save/Submit, the form will not save/submit to the server.
    • SetDirty - resets the IsDirty flag to 'false' on successful submit to allow further changes the next time the form is opened.
    • IsReadOnly - checks if the form is currently opened by another user and prevents save/submit if so.
    • ClearErrors - clears validation errors to allow users to save the form regardless if the required fields have been completed or not.
    • GetErrorCount - counts the number of validation errors in the form; if present, users will not be allowed to submit.
    • SetCaption - sets the form title to the form's name in the SharePoint library.
    • SetSave - prevents File > Save to the SharePoint library.
    • Bonus:
      • Checks if a newer version exists on the server.
      • Detects the form status (Saved/Submitted), version and DocID which are all displayed on the form's footer.
    Click here to download the sample form.
    Posted Dec 31 2010, 02:06 PM by Mel Balsamo with no comments
    Filed under:
  • Free Training: Using InfoPath Workflow

    You may be familiar with SharePoint workflow, but have you added workflow to an InfoPath template? InfoPath workflow is easier to use because it's handled in InfoPath instead of requiring the user to complete certain actions in SharePoint.

    Users can easily see the state of the form and you can add custom conditional viewing to switch views based on the user role (e.g. a private Comments section in a Manager's view).

    During this lab, you will modify a Timesheet form template to pull user information from Active Directory, submit to SharePoint, and pass the SharePoint link in the notification email.

    Retrieving the Users' Active Directory Information

    If you go to Data > Data Connections, you'll see the pre-configured data connections that use Qdabra DBXL's Active Directory Web Service methods to retrieve the users' information.

    And if you go to Data > Form Load, you will see a rule that populates the user info:

    We're basically setting the fields in our form to the values retrieved from the Active Directory web service methods and using filters to specify which Key to use.

    Add the Submit Data Connections

    Start by modifying the starter template to add data connections that submit the form to SharePoint and through email.

    1.       Open the Starter Template XSN (included in this lab) in InfoPath Designer.

    2.       Save the template on your local machine by going to File > Save As and saving it with the name Timesheet.xsn

    3.       Add the data connection to submit to your SharePoint library.

    a.    Go to Data > Data Connections > Add > Create a new connection to submit data > To a document library on a SharePoint site

    b.    Enter the name of your document library, such as http://training.qdabra.com/personal/<<username>>/

    c.    For the File Name, click on the fx button and insert the formula:

    concat(tc:week/tc:weekOf, " - ", tc:employee/tc:name/tc:singleName)

    If you click on the Verify Formula button, you should see the following:

    d.    Click OK in the Insert Formula dialog.

    e.    Check the box ‘Allow overwrite if the file exists'.

    f.    Click Next, leave the default data connection name, and then click Finish.

    4.       Add an email submit data connection.

    a.    In the Data Connections dialog, click Add > Create a new connection to submit data > As an email message

    b.    Click on the fx button next to the To field and select the emailto field which you'll find under the my:actions group in the main data source.

    c.    Click on the fx button next to the Subject field and enter the formula:

    concat("Time Card: ", tc:week/tc:weekOf, " - ", tc:employee/tc:name/tc:singleName, " has been ", my:actions/my:status, " by ", my:actions/my:modifiedby, ".")

    If you click on the Verify Formula button, you should see the following:

    d.    Click OK in the Insert Formula dialog and then click Next.

    e.    Make sure that the option ‘Send only the active view of the form and no attachment' is selected.

    f.    Click Next, leave the default data connection name, and then click Finish.

    5.       Click Close to exit out of the Data Connections wizard.

    Add the Rules that Trigger the workFlow

    In the Employee (default) view, you'll see a Submit button. This button will have rules that will set the form fields' values that are being used in the workflow, such as who modified the form, whom is it assigned to after the form submits, which email address should it be sent to, etc. Same goes for the Approve and the Reject buttons which you'll find in the Manager view - they have rules that trigger the workflow.

    Since the form also has a Form History section for tracking purposes, you may find other rules that set the history data. These have already been added in the form so we can concentrate on implementing the logic that is associated with the workflow.

    Start by modifying the Submit button:

    6.       In the Employee view, click on the Submit button.

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

    You will see the following pre-configured rules:

    8.       Add a rule that sets the metadata

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

    b.    Name your rule ‘Set Metadata'.

    c.    Move the rule up so that it's the third in the set, i.e. after the rule ‘Warn: Need Hours'.

    d.    Set the modifiedby field:

    i.    Click Add > Set a field's value.

    ii.    For the field, select modifiedby under the my:actions group:

    iii.    For the value, click on the fx button and select singlename under employee > name

    You can also just enter the following XPath in the Insert Formula dialog: tc:employee/tc:name/tc:singleName

    iv.    Click OK to close the dialogs.

    e.    Set the assignedto field:

    i.    Click Add > Set a field's value.

    ii.    For the field, select assignedto under the my:actions group.

    iii.    For the value, click on the fx button and select singlename under employee > name.

    iv.    Click OK to close the dialogs.

    f.    Set the emailto field:

    i.    Click Add > Set a field's value.

    ii.    For the field, select emailto under the my:actions group.

    iii.    For the value, click on the fx button and select emailAddressPrimary under company > contact. You can also just enter the following XPath in the Insert Formula dialog: tc:company/tc:contact/tc:emailAddressPrimary

    iv.    Click OK to close the dialogs.

    g.    Set the status field:

    i.    Click Add > Set a field's value.

    ii.    For the field, select status under the my:actions group.

    iii.    For the value, enter the text Submitted

    iv.    Click OK.

    h.    Set the notes field:

    i.    Click Add > Set a field's value.

    ii.    For the field, select notes under the my:actions group.

    iii.    For the value, enter the text Submitted to Manager

    iv.    Click OK.

    You should now have the following Submit button rules that set the metadata:

    9.       Add a rule that submits the form:

    a.    Click New > Action.

    b.    Name your rule ‘Submit' - this will be the last rule in the set.

    c.    Submit to SharePoint:

    i.    Click Add > Submit data.

    ii.    Select your SharePoint Library submit data connection from the drop-down:

    iii.    Click OK.

    d.    Set the done field:

    i.    Click Add > Set a field's value.

    ii.    For the field, select done under the my:actions group.

    iii.    For the value, enter 1

    iv.    Click OK.

    Notice the conditional formatting in the Submit button:

    This means that we want the Submit button to be disabled if the value of the done field equals "1" which we set after the form submits to SharePoint. This will prevent users from clicking on the Submit button twice which may result to double-submits.

    e.    Submit via email:

    i.    Click Add > Submit data.

    ii.    Select your email submit data connection from the drop-down.

    iii.    Click OK.

    f.    Close the form:

    i.    Click Add > Close the form.

    ii.    Uncheck the box ‘If changes have not been saved, prompt the user to save.

    iii.    Click OK.

    You should now have the following Submit button rules that submit the form:

    Next, we will add rules in the Approve button:

    10.    Go to the Page Design tab and switch to the Manager view.

    11.    In the Manager view, click on the Approve button. You will see the following pre-configured rules:

    12.    Add a rule that sets the metadata.

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

    b.    Name your rule ‘Set Metadata'.

    c.    Move the rule up so that it's the second in the set, i.e. after the rule ‘Warn: Need Notes'.

    d.    Add the following actions:

    13.    Add a rule that submits the form:

    a.    Click New > Action.

    b.    Name your rule ‘Submit' - this will be the last rule in the set.

    c.    Add the following actions:

    Finally, we'll add rules for the Reject button:

    14.    In the Manager view, click on the Reject button.

    15.    Add the same ‘Set Metadata' rule that runs after the ‘Warn:Need Notes' rule.

    16.    Add the following actions:

    17.    Add a Submit rule which is the last in the set, and then add the following actions:

    18. Save your changes to your XSN.

    Create the Form Link

    We will add a hyperlink control that links to the form in SharePoint. The link will be included in the notification email so that users can click on it to open the form.

    19.    In the Manager view, you'll see a small section at the bottom. Place your cursor below the label ‘Click here to open this time card:'

    20.    Go to the Insert tab and click Hyperlink.

    21.    In the Insert Hyperlink dialog, change the Link to and the Display options to Data Source.

    22.    Insert the formula:

    concat(substring-before(substring-after(/processing-instruction()[local-name() = "mso-infoPathSolution"], 'href="'), "/Forms/"), "/", tc:week/tc:weekOf, " - ", tc:employee/tc:name/tc:singleName, ".xml")

    The formula is a concatenation of the form location in SharePoint, e.g. http://<YourSharePointSite>/<YourSharePointLibrary>/<FormFileName.xml>

    Recall that we've set the form file name to this formula on SharePoint submit:

    Publish the Template to your SharePoint Library

    In order to access the form template and submit forms, you need to publish it to a location where users can access it from, such as a SharePoint form library.

    23.    Go to File > Publish and then select SharePoint Server.

    24.    Enter the URL to your SharePoint site.

    25.    Leave the default to Form Library and then click Next.

    26.    Select ‘Update existing form library' and select the SharePoint library you created earlier - that is, where you've set your forms to submit to.

    27.    Click click Next twice, click Publish, and then click Close.

    Test by submitting a new Timesheet form assigning it to your manager. Your manager will receive the form via email and will see a link where to access the form.

    The manager will then open the form via the link and will decide whether to approve or reject. Approving goes to HR and rejecting goes back to the original submitter.

  • 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.

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