Mel Balsamo
in

InfoPath Dev

This Blog

Syndication

Mel Balsamo

  • How to make an InfoPath control read-only after signing with the Electronic Signature Template Part

    Electronic Signatures allow you to add signatures to your solutions without the hassle of setting up digital certificates. Qdabra packaged the Electronic Signature template part so that you can reuse it in all of your forms. 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.

    This document demonstrates an example of making a field un-editable after signing it with a signature image stored in a SharePoint library.

    Below is an image of a simple InfoPath form template that uses the Electronic Signature template part:

    Figure01

    In the main data source, we have:

    Figure02

    And in Preview mode:

    Figure03

    Notice that I can place my cursor inside the CompanyName field, which shows that it is not in read-only mode.

    If you have previously used Qdabra’s Electronic Signature template part in your solutions, you’re probably aware that the UserName and the PIN fields become hidden right after your signature image appears – that is, after you have entered the correct and valid credentials. Let’s see what the conditional formatting for our UserInfo section (which holds the UserName and the PIN fields) looks like.
     
     1. Double-click on the UserInfo section to see its properties.
     2. Go to the Display tab and click Conditional Formatting.
     3. You will see that there is only one conditional formatting set up for the UserInfo section. Click Modify.

    Figure04

    The condition “Signature is not blank” is the same as saying that the signature has a value – meaning, a signature image was successfully retrieved because the user entered valid credentials, and there is an existing signature image for that user in the SharePoint library. If that is true, then the UserInfo section becomes hidden. We will apply the same condition to make our CompanyName field read-only.

     4. Click OK three times to close all the open dialog boxes.
     5. Double-click on the CompanyName text box to open its properties.
     6. Go to the Display tab and click Conditional Formatting, then click Add.
     7. In the Conditional Format dialog’s first dropdown, select “Select a field or group”, and expand the nodes to get to Signature (/my:myFields/my:qESxtp/my:Sign/my:Signature), then click OK.
     8. In the second dropdown, select “is not blank”.
     9. Check the box that says “Read-only”.

    Figure05

     10. Click OK three times to close the dialogs.
     11. Preview your form template and fill it out, including the Company Name.

    Figure06

     12. When done, sign it with your electronic signature by entering your UserName and PIN, and checking the “Sign this document” checkbox.

    Figure07

    At this point, I can only highlight the Company Name and can no longer place my cursor inside the text box to edit it.

    This technique will prevent tampering with the data once a form has been signed, hence the security – yet another advantage of using Qdabra’s Electronic Signature template part.

  • How to Use the Qdabra Modify PI Tool for InfoPath

    Scenario

    When you have moved or renamed an InfoPath form template (XSN), the associated XML files become orphaned from their associated template. You will get an error message when you open an XML file because the associated template cannot be located.

    Value Proposition

    The Qdabra Modify PI Tool for InfoPath (QdModifyPI) modifies the InfoPath processing instruction ("HREF") attribute of an XML file to point to the new template's location.

    Requirements

    • Microsoft .NET Framework 2.0 or higher
      Note: If the tool detects that your machine does not have the latest Microsoft .NET Framework, the tool will install it for you.

    Installation Instructions

    1.       Extract the contents of the package installer in a local directory on your machine.

    2.       Run the setup.exe file and as an Administrator - this will ensure that you will have the necessary permissions to use the tool.

    3.       Follow the on-screen instructions in the installation wizard to install the tool.

    Usage

    A. Single XML File

    You may modify the processing instructions, i.e. "relink" XMLs one-by-one. This is useful if you do not intend to relink all of your XMLs. When you install the tool, it adds a right-click menu option.

    1.       In Windows Explorer, right-click on an XML file and select Modify InfoPath PI from the menu.

     

    2.       The Modify InfoPath PI tool will launch, showing the current PI of the selected XML file.

    a.        Enter a new PI - that is, the location of the new form template (XSN) which you wish to associate your XML file with.

    b.       (Optional) Check the box to open the XML file in InfoPath after modifying its PI.

    c.        Click OK when done.

     

    If you have checked the box shown in the image above, the modified XML will open in InfoPath. Otherwise, you can manually open the file at any time.

    B. Multiple XML Files

    This method assumes that you have multiple XML files stored in a directory. Note that the directory should not contain file of types other than XML. Also note that all these files should have the same PI (i.e. they all point to the same location where the associated form template is stored).

    1.       Launch Modify InfoPath PI.exe from the installation folder. (By default, it is installed in C:\Program Files\AutonomySystems\Modify InfoPath PI.)

    2.       In the Target Folder field, enter the local path where you store your XMLs, e.g. C:\InfoPathForms. You can also click on the folder icon and browse to the local folder.

    3.       In the New PI field, enter the full path to the new location of your form template which you wish to associate with your XML files.

     

    4.       Click OK when done.

    5.       To verify that the modification succeeded, open any of the XML files in the selected directory. The file should open with the new InfoPath form template specified. You can also open any XML file in a text editor such as Notepad and verify that the HREF has changed.

     

    Migrating XMLs from One SharePoint to Another

    When InfoPath form files are saved to a SharePoint Form Library, SharePoint creates hard-coded references to the form template in the team site where the forms are being saved.  If the SharePoint Form Library is moved to a new location, the references in the InfoPath form files will continue to point to the old location, even after they've been moved into the new Form Library. You can update these references in the form files manually or by using a tool.

    The steps below assume that you already have two existing SharePoint libraries, and that you have published your form template (XSN) to both locations.

    Export: Copy the XMLs from Form Library A

    Export the XMLs by copying them from the first form library (we'll call this Form Library A) to your local machine.

    1.       Open Form Library A in Internet Explorer.

    2.       Click on the All Documents drop-down > Explorer View - this will allow you to drag & drop and/or copy all the XMLs at once.

     

    3.       Highlight to select all the existing XMLs and drag them into a folder in your local machine, e.g. D:\SampleForms.

    Use the Tool to Modify the XMLs

    Modify the Processing Instructions of the XMLs using the tool to point them to the form template published in the second form library (we'll call this Form Library B).

    4.       Launch the tool from the installation folder. (By default, it is installed in C:\Program Files\AutonomySystems\Modify InfoPath PI\Modify InfoPath PI.exe.)

    5.       In the Target Folder field, enter the local path where you placed your XMLs, e.g. D:\SampleForms. You can also click on the folder icon and browse to the local folder.

    6.       In the New PI field, enter the full path to the form template that you published in Form Library B.

     

    7.       Click OK.

    The tool will close after successfully modifying PIs of the XMLs in the folder.

    Import: Upload the XMLs to the New Location

    When done modifying the XMLs and they're now pointing to the new location, you can then upload them to Form Library B.

    8.       Open Form Library B in Internet Explorer.

    9.       Click on the down-arrow key next to Upload and then select Upload Multiple Documents.

     

    10.    Drag the updated XMLs from your local folder and drop them into the SharePoint window.

     

    11.    Click OK, and then click Done.

    Your forms should now open with the template in the new SharePoint location.

     

    Purchase the Qdabra Modify PI Tool for InfoPath here.

  • Using InfoPath E-mail Forms to Communicate with External Users

    Greg’s blog post provided brief guidelines on how to create form templates with different versions. One is a restricted version for public-use, i.e. for external users; the other is a version for private use. The private version may contain some additional controls that allow you to do more with your forms, such as submitting them to a SharePoint document library.

    This technique gives us the power to use InfoPath forms to capture offline e-mailed data for centralized SharePoint upload. We can email forms back-and-forth, to and from external users (sometimes offline or disconnected), and at the same time, manage those forms in private locations such as a SharePoint site. We need to make sure that the form data in both the public and the private locations are in-sync.

    This blog post details the steps to setup a sample email form template with two different versions: Public and Private.

    Here’s a diagram of the scenario we’re trying to accomplish: 



    1. You email the form template (XSN) file to an external user (Public version – Ver. 1).

    2. External user (sometimes offline) opens the form template, fills it out and emails back to you.

    3. You receive the form (XML) and open it with the higher version of the form template (Private version – Ver. 2).

    Note that you may receive a warning message that the form template associated with the form has a higher version than the one stored on your computer. Clicking Yes will open the form with your latest version.

    4. You submit the form to your SharePoint document library.

    5. You open the form from SharePoint, edit it and email it back to the user.

    6. User receives the form, accepts the changes, re-edits and re-emails back to you.

    Note that the user may also receive a warning message about the form template version. Clicking Yes will allow user to open the latest form.

    7. You receive the form and re-submit it to SharePoint.

    Sounds interesting? Let’s get started…

    REQUIREMENTS:

    • InfoPath 2007
    • Outlook 2007
    • SharePoint Library

    PUBLIC VERSION

    1. Add the following fields to your main Data Source  



    • Make the EmailAddress field required, so we know where to send the form back.

    2. Add a layout table in your template, and drag the myFields node onto your table as Controls in Layout Table. Expand your controls as necessary to make them fit in your table.

    3. Double-click on your Date field to open its properties.

    a. Under the Data tab, click Format. Select any format for the time such as: 



    b. Click OK.

    c. Back in the Data tab, click on the fx icon beside the Value field, and enter the now() function in the formula box. 

    This will ensure that we’ll have a unique date value every time we fill out a form the first time. We will specify this unique value as the form filename in our SharePoint library later.

    d. Click OK to close all the dialog boxes.

    4. Allow the Comments field to display multi-line in the Comments field properties > Display tab, just so there’s more space for users to fill it out.

    Your form template should look something similar to this:  



    5. Add a Submit data connection.

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

    b. In the Data Connection Wizard, select Submit data > As an email message.

    c. Specify an email address where you want your external users to send the form to; i.e. <YourEmail>@<YourCompany.com>.

    d. You can enter any value as the email subject or select an existing field in your form template. In this example, we will use our Name field as the Subject. 

    e. Click Next.

    f. Select the option Send the form data as an attachment.

    g. For the attachment name, combine the Name and the Date values. Click on the fx button beside the Attachment Name field, and enter concat formula as seen in the following image, making sure that the underlined fields are from your main data source: 

    h. Click OK (no need to attach the form template in the email), Next, then Finish to exit out of the wizard.

    6. Add and configure a Submit button.

    a. Add a button at the bottom of your table, and double-click to open its properties.

    b. In the Button Properties window’s General tab, select Submit in the Action dropdown, and click Submit Options.

    c. Check the box Allow users to submit this form > Email > Email Submit.

    d. Click the Advanced button to expand the window, and select Close the form in the After submit dropdown: 

    7. Make the form restricted for external users.

    a. Go to Tools > Form Options > Security and Trust.

    b. Uncheck the box for Automatically determine security level, and select Restricted: 

    c. Click OK.

    8. Save the form template as PublicEmailForm.xsn.

    Here’s how our public email form template looks like: 

    PRIVATE VERSION

    Next, we will design our private form template. It will have the same fields, so we can just modify our public form template.

    1. While the public template is opened in Design mode, go to File > Save As and save it as PrivateEmailForm.xsn (to make sure that we are not working on the public version).

    2. Modify the Email Submit data connection.

    a. Go to Tools > Data Connections and modify Email Submit.

    b. Click on the fx button next to the To field and insert the EmailAddress field. This field will contain the external user’s email address (where we wish to send the form back to).

    c. Click Next twice, and then Finish to save your changes.

    3. Configure the SharePoint Submit data connection.

    a. In the Data Connections wizard, click Add to add another data connection.

    b. Select Submit data > Next > To a document library on a SharePoint site > Next.

    For the purposes of this tutorial, we will submit to a SharePoint document library named EmailFormsLibrary. This library should not exist yet. We will create it later when we publish our private form template.

    c. Enter the URL to your EmailFormsLibrary SharePoint library, i.e. http://<SharePointSite>/EmailFormsLibrary/

    d. For the file name, click on the fx button and select Date from your main data source. Again, we are making sure that our form file name is unique each time we submit a form to our SharePoint Library the first time; thus selecting Date which uses the now() function.

    e. Check the box that allows overwrite if file exists. 

    f. Click Next, leave the name as SharePoint Library Submit, and then click Finish.

    g. Exit out of the Data Connections wizard by clicking Close.

    4. Configure the submit buttons.

    Note that we now have two Submit data connections, and we therefore need to use two buttons: one that submits to our SharePoint library, and another to email the form back to the external user. We also need to submit using rules and specify which Submit data connection to use.

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

    b. In the Action dropdown, select Rules and Custom Code.

    c. Label the button Submit to SharePoint and click on Rules.

    d. In the Rules dialog, click Add.

    e. Name your rule SharePoint Submit and click on Add Action. The action would be to submit using the SharePoint Library Submit data connection: 

    f. Click OK three times to close the dialog boxes.

    g. In the Controls task pane, select Button to add another button just beside the SharePoint Submit button, and double-click to open its properties.

    h. Label it as Email External User and click Rules.

    i. In the Rules dialog, click Add.

    j. Name your rule Email External User and click on Add Action. The action would be to submit using the Email Submit data connection: 

    k. Click OK three times to close the dialog boxes.

    5. Since we’ve already configured our submit function to use rules instead of the built-in submit feature, we can now disable that. In Tools > Submit Options, uncheck the box that allows users to submit the form, and click OK.

    6. Set the security mode.

    Since this form template is a private version, meaning it is used internally by users in your network/domain, we can allow the form to access content from the domain in which it is located.

    a. Go to Tools > Form Options > Security and Trust and select Domain (or Full Trust). 

    b. Click OK.

    Here’s how our private email form template looks like: 

    7. Save your PrivateEmailForm.xsn form template and then close it.


    MANIPULATING FORM VERSIONS

    Here’s where it can get a bit complicated. We want to manipulate InfoPath to think that our Public and Private forms are one-and-the-same, when in fact, they are two different forms. To make this happen, first, we need to give these two form templates the same ID. This is considered as a “Class A” trick.

    As mentioned in Greg’s blog post:

    The ID is used to determine which template a form will be opened with. But this ID is dynamic. As the Name changes, so does the ID. And every time you do a Save As, the Name and ID are changed.

    A. Let’s start with our public form template:

    1. Open PublicEmailForm is InfoPath Design mode.

    2. Go to File > Properties. Here you will find fields for the Name, ID, and Description. 

    3. To make things simpler and easier to understand, let’s remove the date and time stamp in the template’s URN: 

    4. Click OK then File > Save.

    5. Since this template is what we will email our external users with, we need to save it with a different name.

    a. Go to File > Save As and name it EmailForm.xsn.

    b. In File > Properties, notice that the Name and ID changed. 

    c. Once again, remove the date and timestamps in the URN to avoid confusion. 

    d. Click OK.

    e. Go to Tools > Form Options > Versioning. Notice that the Version number is something like 1.0.0.x, where x is a number that automatically increments as we make changes to our template. We can leave it this way for our public email template.

    f. Click OK, then File > Save.

    6. We’ve already saved the public version as EmailForm; close it, and then send it to an external user by attaching the form template in the Outlook message.


    B. Next, our private form template:

    1. Open PrivateEmailForm.xsn in InfoPath Design mode.

    2. We need to make sure that our private template will have a higher version number than the public one.

    a. Go to Tools > Form Options > Versioning.

    b. Change the Version Number from 1.0.0.x to 1.0.1.x. This way, when we open the forms (XML) in our local machine, they will open with the higher template version, which is the private one. Click OK.

    3. Go to File > Properties: 

    4. Remove the date and time stamp in the template’s URN: 

    5. Click OK then File > Save.

    6. This time, we will overwrite our previous EmailForm.xsn with this private form template.

    a. Go to File > Save As > EmailForm > Overwrite.

    b. In File > Properties, the Name and the ID once again becomes: 

    c. Remove the date and time stamps, click OK then Save.

    Notice that this template (private version) has the same ID as the one that we sent to our external user (public version). Don’t be confused, this template has a higher version number than the one already sent. As we know, forms will open with the higher version template.


    C. Publish the private version to a SharePoint library

    1. In EmailForm.xsn’s (previously PrivateEmailForm) File menu, click Publish.

    2. Select to publish to a SharePoint server with or without InfoPath Forms Services, and click Next.

    3. Enter the URL to your SharePoint site and click Next.

    4. Select to create a Document Library > Next.

    5. Select Create a new document library > Next.

    6. Enter a name for your document library (remember that we wish to submit our forms to a library called EmailFormsLibrary). Click Next.

    7. Promote some or all of the fields in your form as columns: 

    8. Click Next, then Publish, then Close.

    9. Close InfoPath.


    SEE IT IN ACTION

    1. Have an external user fill out and submit the public template you initially emailed.

    2. You will receive the form (XML) in your email. 

    3. In Outlook, click Open Form. It will open with the private version of the template. 

    4. Make some changes in the form, such as editing the Comments, and click the SharePoint Submit button. 

    5. Close the form in Outlook. If you get a warning asking you if you wish to save the form, select No.

    6. Verify that the form is submitted to your SharePoint document library. 

    7. Open the form from SharePoint, make some changes, and email it back to the external user by clicking the Email External User button. 

    8. The external user will receive the modified XML and may receive a warning that the form template associated with the form contains a higher version. Clicking No will allow the user to open the form in Outlook using the public version.

    9. The external user then modifies the form and emails it back to you by clicking the Submit button. Once again, if you open the received XML in Outlook, it will open with the private version:

    10. Re-submit the form to your SharePoint library to make sure you are keeping the latest XML version. It will overwrite the existing XML in your SharePoint library: 

    At this point, we should have three form templates in our machine: PublicEmailForm, PrivateEmailForm, and EmailForm. We are only concerned about EmailForm, as this form template contains the unique Name and ID that we wish to send back-and-forth, to and from our external users, and manage our SharePoint library forms with.

    The PublicEmailForm and the PrivateEmailForm are just temporary placeholders. For instance, if you wish to send a public version to another external user, we can’t send them the latest EmailForm that we have (since it’s supposed to be the private version). To do this, we need to open PublicEmailForm in InfoPath Design mode, and re-save (overwrite) it as EmailForm. After sending to the external user/s, open PrivateEmailForm in Design mode and re-save (overwrite) it as EmailForm, and then re-publish to the same SharePoint document library.

    You’ll realize that we’re just manipulating the same form template in terms of which version will be sent to public, and which version should open in our machine.

    Once you get the hang of this, it will be easy for you to manage your form data and keep them in-sync no matter where you publish your forms.

  • Qdabra’s New Email Builder Tool

    Figure01

    Everyone gathers contact information. Let’s face it: people are the backbone of our business and we need to know how to reach them. We gather this information by collecting the data in forms. Unfortunately, it can be very difficult to reuse this information for other programs, such as an email list. So if you have ever wanted to pull email information out of existing forms in order to reuse that data for sending emails, then Qdabra’s new email builder tool is the answer for you! Our new Email Builder tool is a great way to send out polished, personalized e-mails to one or more recipients based on data residing in a separate InfoPath form.

    This exercise assumes that you have a document type in DAT that maps to a database and stores information that is essential when sending emails, like an email address. The diagram below shows an example of this process:

    Figure18

    Setup

    1. Download the templates from this address and save to your DAT using the New Configuration button.

    2. Install PT_EmailBuilder template and the QdEmailRecord template as separate DocTypes.  For information on creating new DocTypes, refer to DBXL’s Getting Started manual. 

    3. Additionally you will need to map the QDEmailRecord DocType to a database.

    a. Create a table in your SQL database named EmailRecord with the following columns and data types:

    Figure02


    b. Map each column to node paths specified below: (For additional help on mapping to Databases, review How to Create Database Mappings in DBXL.)

    Figure03

    Using Email Builder

    Once this is complete, you are now ready to test the Email Builder tool. From DAT, launch PT_EmailBuilder by double-clicking on the EmailBuilder form template in your DAT. Your new Email Builder will launch.

    Set the name of your email template and add a company logo using the Insert Picture field:

    Figure04

    Next, enter the details that will be shared with others. This information will appear at the bottom of your completed email.

    Figure05

    Add information for your Subject Line, Greeting and Farewell:

    Figure06  

    Add your email body: (Note that most text formatting will be acceptable in this format.)

    Figure07

    Finally, upload a signature image and title to sign the email.

    Figure08

    Now let’s go and add some recipients!

    Click on the “Pick People” tab:

    Figure09

    You will now choose the DBXL document type that you use to store your contact information. 

    Figure10

    You will also indicate the table that references the information you want to capture.

    Figure11

    Choose the column that contains your recipient name and the contact email address. You can use the Alt. Identifier Columns if you need to specify between same names or other information that may appear to be duplicated (i.e., if you have two Joe Smiths in your data).

    Figure12

    You can also choose to filter the contact list to better customize your list. You can also choose to filter the contact list to better customize your list. For example, you can filter using the contact’s CompanyID and specify a value, or filter through the LastContactDate, etc.

    Figure13

    After clicking the “Find Email Recipients” button, a list of contacts will display to match your filter criteria.  You can now send your emails individually, or you can also choose to cancel an email.

    Figure13

    Save your email template using the “Save Email” button located at the top of the page. You will now have a reference that will contain the exact email that was sent in case you want to reuse it. You will also be able to see whom you sent that email to when you last sent it out, which will be very useful for recurring emails.

    So now that we have whom we want to email, let’s see what our email will look like!

    Click any link marked “Email” to any of the recipients.

    Your Outlook will launch and will display your email, address, etc. Click “Send” and your email will be sent! Please note that you will have to send each email separately. (If you are sending out marketing materials, this will be helpful in having them not sent to the SPAM folder!)

    Figure15

    You can click the “Done” button to put a date and time stamp on the sent email that is logged in the database. It is that easy!

    Figure16

    You will also be able to see a list of the people you have sent emails to. After you click “Done”, each recipient will show up with a date and time stamp that the email was sent.

    Figure17

    Once you started using the Email Builder, you will discover how easy it use to manage and send emails and keep organized at the same time.

    Download the Email Builder tool
    here.

    "Limitation: due to security restrictions in InfoPath’s email adapter our Email Builder tool currently requires manually clicking a button to send each request. As such, it is not a good solution if you have more than 100 customers. For larger lists you can use Report Builder tool in DBXL v2.5 to generate an Excel Spreadsheet and upload that to Mailchimp. We are working on a way to automate the Email Builder tool so that you can do large bulk emailings without having to click through each send."


  • Active Directory Template Part

    The Active Directory Web Service is a very powerful tool for retrieving user information in our solutions, making them easier to fill out. What’s even more convenient is the ability to just inject it into our forms in a single mouse-click – and there’s the Active Directory template part.

     

    This blog post details the steps on how to create a template part (XTP) that calls the Active Directory Web Service and retrieves the currently logged in user’s information, as well as the manager’s. Follow along and use the template part as many times as you wish!

     

     This template part tutorial uses Qdabra’s Active Directory Web Service that comes with DBXL. To download a free DBXL trial, click here.

     

    1)      Open InfoPath and design a new blank template part.

    2)      Add the following groups and fields to your main data source:

    3)      Design your XTP as shown below:

    4)      Add secondary data connections:

    a.       Go to Tools > Data Connections > Add.

    b.      Create a new connection to receive data from a Web service.

    c.       Enter the URL: http://<servername>/QdabraWebService/ADUserInfo.asmx where <servername> is the location where DBXL is installed.

    (Note: If you are using the Active Directory Standalone Tool, the URL should be http://<servername>/QdabraAD/ADUserInfo.asmx)

    d.      From the list of operations, select GetMyInfo.

    e.      Check the box that says “Automatically retrieve data when the form is opened”, then click Finish.

    f.        Repeat Steps 4a to 4d to add data connections for the GetUserInfo and GetManagerAlias methods.

    ·         You can leave the parameters blank as we will specify each of them later as we continue designing our form.

    ·         For the rest of the methods, uncheck the box that says “Automatically retrieve data when the form is opened”.

    g.       When done, exit the data connections wizard.

     

    5)      Configure the EmployeeInfo fields:

    a.       Double-click on the EmployeeName field to display its properties.

    b.      In the Data tab, click on the fx button to set a default value.

    c.       In the Insert Formula window, click the Insert Field or Group button.

    d.      Select the secondary data source GetMyInfo from the data source drop-down.

    e.      Expand the dataFields node to display Value, and click Filter Data.

    f.        Add a filter so that it only displays data when Key is equal to the text displayName.

    g.       Click OK until all the dialogs are closed.

    h.      Repeat Steps 5a to 5g for the EmployeeEmail field, except that Value should be filtered such that Key is equal to the text mail.

    Hint: To view a list of all the Active Directory keys, drag the whole ADProp node (/dfs:myFields/dfs:dataFields/tns:GetMyInfoResponse/tns:GetMyInfoResult/tns:ADProp) as a repeating table onto your form, and then preview.

     

    6)      In the Controls task pane, click to add a button between the Employee Info and the Manager Info table.

    7)      Double-click on the button to display its properties.

    8)      Label the button as Get Manager Info, and click Rules > Add > Add Action.

    9)      Add the following actions to query your manager’s alias using your alias which we obtained through GetMyInfo:

    a.       Set the field /dfs:myFields/dfs:queryFields/tns:GetManagerAlias/tns:username to the value of /dfs:myFields/dfs:dataFields/tns:GetMyInfoResponse/tns:GetMyInfoResult/tns:ADProp/tns:Value filtered such that Key is equal to sAMAccountName.

    b.      Query using the GetManagerAlias data connection.

    c.       Set the field /dfs:myFields/dfs:queryFields/tns:GetUserInfo/tns:username to the value of  /dfs:myFields/dfs:dataFields/tns:GetManagerAliasResponse/tns:GetManagerAliasResult

    d.      Query using the GetUserInfo data connection.

    e.      Set the ManagerName field /my:myFields/my:ManagerInfo/my:ManagerName to the value of /dfs:myFields/dfs:dataFields/tns:GetUserInfoResponse/tns:GetUserInfoResult/tns:ADProp/tns:Value filtered such that Key is equal to displayName.

    f.        Set the ManagerEmail field to the value of /dfs:myFields/dfs:dataFields/tns:GetUserInfoResponse/tns:GetUserInfoResult/tns:ADProp/tns:Value filtered such that Key is equal to mail.

     

    Your button rules should be similar to this:

     

    10)   Still in the button properties window, go to the Display tab > Conditional Formatting > Add.

    11)   Add the following conditions to disable the button if the Employee Info fields are blank:

    12)   Click OK to close all the dialogs.

    13)   Preview your template part. The Employee Information table will auto populate with your Active Directory Information. Clicking the Get Manager Info button retrieves your manager’s info as well.

    14)   Save your template part.

     

     

    For you to be able to use it in your forms, you must first install the template part in InfoPath. Here are the steps to do that: 

     

      1. In InfoPath Design mode, click Controls in the task pane, and scroll down to the Custom section found at the very bottom of the task pane.
      2. If you haven’t installed any custom controls (like template parts), you will see that the Custom section is empty. Click Add or Remove Custom Controls, and then click Add in the dialog box that appears.
      3. In the Add Custom Control Wizard, select Template Part from the options and click Next.
      4. Browse to the path of your template part, and click Finish then Close when done.
      5. The template part will now show in the list of your installed template parts. Click OK to close the dialog box.
      6. After successful installation, the template part will now be available in the Custom section of the Controls task pane.

    To use it in your form, just click the template part and it will be shown on InfoPath’s design area. You can then continue designing your form and edit the sections in the template part as necessary.

     

    Additional Info:

    If you have added a template part to InfoPath as a custom control, modifying the template part will not change the control. You have to uninstall the current version from your custom controls in InfoPath (using Add or Remove Custom Controls) and then add your new version.

     

    In a real working environment, you must send the updated template part to anyone who is using the original. After the updated template part is installed on each computer, the users are notified that an update is available, thus the need to update the existing forms that are using the template part.

      

    *** The Active Directory template part is included in the Active Directory Standalone Tool. Click here to purchase the tool. ***

     

  • Smart Links - Speed up Contact Lookups!

    In a previous blog post, we’ve shown you a template part called Contact Block Advanced, and described how useful it is for keeping a record of contact persons / employees for every company, all in one place. One of its cool features is the ability to speed up contact lookups by using Smart Links. This blog post shows you how to create a sample form that uses Smart Links. Start by following the steps below and see how amazing and convenient it is to use Smart Links in your solutions.

     

    1.       Design a blank InfoPath form template.

    2.       Add the following nodes to your main data source: 

     

     

    3.       Add tables and controls to your form similar to this:

      


     

    4.       Add default values to the Address1 attributes:

    a.       In the Data source task pane, double-click on the GoogleMaps attribute and specify a default value:

     

    concat("http://maps.google.com/maps?q=", .., ", ", ../../my:Address2, ", ", ../../my:City, ", ", ../../my:State, " ", ../../my:Zip, " ")

     

    Click on Verify Formula to check that you have entered the correct one. Your formula should be similar to this:

     


     

    b.      Double-click on the LiveSearch attribute and specify a default value:

     

    concat("http://maps.live.com/default.aspx?where1=", .., ", ", ../../my:Address2, ", ", ../../my:City, ", ", ../../my:State, " ", ../../my:Zip, " ")

     

     

    c.       Do the same for the MapQuest attribute:

     

    concat("http://www.mapquest.com/maps/map.adp?address=", .., ", ", ../../my:Address2, "&city=", ../../my:City, "&state=", ../../my:State, "&zipcode=", ../../my:Zip)

      

     

    5.       Add hyperlinks to Address1 that link to its attributes:

     

    a.       Add a space after the Address1 label, right-click and select Hyperlink:

      

     

    b.       For the Link to, select Data source and enter my:Address/my:Address1/@my:GoogleMaps. Enter GoogleMaps in the Text field under Display.

     

     

     

    c.       Do the same for LiveSearch and MapQuest:

    LiveSearch – my:Address/my:Address1/@my:LiveSearch

    MapQuest – my:Address/my:Address1/@my:MapQuest

     

    d.      You can add open and closed parentheses, as well as separators for the hyperlinks so they’d look neater:

      


     

    6.       Do the same for all the other remaining attributes, specifying the following default values and pointing each hyperlink to its corresponding data source:

     

    a.       Phone (@call to) - concat("callto://+1", ..)

    b.      Email (@mail to) - concat("mailto://", ..)

    c.       Website (@url) - concat(substring("http://", 10 * number(contains(.., "://"))), ..)

     

    Your form should be similar to this:

     

     

    Test your form in Preview mode by filling out the fields and clicking each corresponding Smart Link:

     

    Address (LiveSearch):

     

     

     

    Phone (Skype Call):

     

     

     

    Email (Send Mail):

     

     

    Website (Visit Website):

     

     

     

    Smart Links are the best way to go to look up data in your forms. It is mostly useful in solutions that contain contact information. You can even create template parts that use Smart Links, and use them in your forms right away.

     

    NOTE: The Smart Links used in this blog post are applicable only in the United States.

  • Electronic Signature Template Part

    Would you like to add signatures to your form, but are concerned about the challenges of setting up digital certificates? Qdabra’s Electronic Signature Template Part may be right for you! Here’s a sneak peak:

    Figure1
    Note: The PIN field is highlighted as shown in the figure above, but it normally wouldn’t be seen since the texts are colored white.

     

    User enters invalid information:
    Figure2

    User enters valid information:

    Figure3
    What is it? What does it do?

    -          Electronic signatures don’t require digital certificates

     

    -          Electronic signatures ask for a personal identification key, for example a PIN

     

    -          Electronic signatures use your logged-in user credentials to look up a previously recorded key in the Signature library

     

    Ø  If the entered data matches the key data stored in the Signature library, the electronic signature adds a signature image to your form.

     

    -          Electronic signatures can include a purpose field for auditing

    -          Electronic signatures template part is designed in a way that it's plug-and-play, so you can easily use them in your forms

          InfoPath 2007 introduces XML Template Parts (XTPs),  which let you take whole sections of a form – fields, rules, data connections, conditional UI, etc. – and package them up so you can reuse them in all of your forms.

     

    What will I need to use the Electronic Signature Template Part in my InfoPath form?

     

    -          InfoPath 2007 or later –Template parts (XTPs) are not supported in InfoPath 2003

     

    -          SharePoint 2007 or SharePoint 2010 lists - securely store PINS and signature images

    -          Scanned in signatures and users' aliases – to create above list

     

    Why do I need SharePoint?

     

    SharePoint feature alert! One of the best things to note about using SharePoint is that there is no need to create a form to store the signature. Your users can store their signature in a picture library and secure each signature image so that users cannot access other users’ signatures and PINs. And the best part is – no code needed!

     

    Why not a secondary XML resource?

     

    Good idea! We could add a secondary XML file in the InfoPath template that stores the employee alias, PIN and signature image (as Base64), but here again, we have two issues:

     

    a)      Security – we’d have to encrypt the PIN so that users couldn’t steal it by cracking open the cached template file. Encryption requires code and that won’t work for XTPs.

     

    b)      Updating the XML file would be costly. Every time a new employee joins, you have to update the file.

    Granted, the security issue is only a big deal if you have malicious users and you could make it a little harder by hiding the Design This Form button in the toolbar. Fair enough! If you don’t have SharePoint, and want us to blog the non-secure secondary XML file send us e-mail and complain loudly. If we hear from enough of you, we’ll post another blog using the XML file technique.

     

    If you don’t have SharePoint, you can still read about the technique to learn about how to use XTPs.

     

    Why not digital signatures? What limitations do electronic signatures have?

     

    Security warning: An electronic signature doesn’t prevent a malicious user from downloading and modifying the XML data after signing. That’s what Digital Signatures are for – they include special checks that prevent data tampering. The problem with Digital Signatures is that they require digital certificates and that means you have to have your system admin turn on Certificate Authority, or purchase certificates from a Web provider. Electronic signatures are a semi-secure substitute and with SharePoint permissions, you can prevent most tampering using the following three techniques:

     

    a)      Don’t store employee’s PINs in the main data source. Even though you need the field in the XTP, you can blank the field out after you replace it with the signature image (assuming the user entered a valid PIN)

     

    b)   Remove the Save and Save As options from the InfoPath File menu (Form Options -> Open and Save)

     

    c)   An administrator secures each signature image so that users cannot access other users’ signatures and PINs. A good way to do this is to have an admin upload “dummy” signatures and PINs and then place security on each one.  The users can then go in and modify the signature image and PIN, replacing them with their own.

     

    d)   Digital Signatures require domain users but Electronic Signatures do not.

    Are you ready to create the solution?

     

    Create your Picture Library

    1.      Create a SharePoint Picture library in a location accessible to all employees needing an electronic signature by going to Site Actions > View All Site Content > Create and choose Picture Library.

     

    2.      Give your picture library a name such as ElectronicSignatures, and choose whether or not you want to add it to the Quick Launch bar and create versions. Click Create.

     

    Note: Since we’re using a separate library for the PIN storage, make the picture library read only for all users. Each signature should be editable by whomever it belongs to. The issue is that currently, the signature is populated by a link. If the link is not reachable by other users, the signature will not show in the form. So the URLs of the picture library need to have read access. Signature is then created from pulling the pin from one list and the document from another.

      

    3.      Upload “dummy” or false signatures using the following guidelines:

     

    a.      Signatures should all be of the same type (.jpg, .gif, .tiff, etc.)

     

    b.      Signatures should be given the name that the user has for his/her Network ID (machine name). For example, if the network recognizes John Smith as SHAREPOINT\JSmith, his signature should be named “JSmith”.

    In some cases, the document’s Name field is not available to users, so we can make use of the Description field too. Enter the same name (user’s network ID) in the Description field.

     

    c.       Signature image “Title” should be the user’s full name.

     

    d.      Signatures should all be uploaded to the same library.

     

    4.      Once all the dummy signatures are uploaded, have an administrator go in and secure each of the signatures.

    a.      Select a signature picture by clicking on it. The picture will display as an enlarged thumbnail with a toolbar across the top.

     

    b.      From the toolbar, select Manage Permissions.

     

    c.       Currently, each picture inherits its permissions from the library it resides in, so first we need to break inheritance. Click Actions > Edit Permissions. You will receive a warning that you are breaking inheritance.
    Figure4

    d.       Click OK to continue.

     

    e.      Your permission list will now have check boxes next to all the users.
    Figure5

    f.        Ensure that the owner of the electronic signature is listed as one of the users in this list.

     

    If they are not, select New > Add Users. Choose the owner of the signature by typing their username or using the browse function of the Add Users text box. Select the permission level you want them to have (Contribute is the safest option. This will allow them to manage their signature without being able to change the permissions on it.) Click OK.

     Figure6

    g.      Once the user is added to the permissions list, place a check in the boxes next to all the other names, and click Actions > Remove User Permissions. You will be asked if you are sure you want to do this. Click OK. The other users will be removed from the list and the only remaining user should be the owner of the signature.

     

    h.      You may test this by signing in with a dummy account or having another user who does not have access to the signature sign in with their account. They should not see the protected signature.

     

    i.        Now that your signatures are protected, have your users go in and change the dummy signature image to be their real signature that is in .jpg format. They can just give their signature the same name, that is their useralias, and upload it – it will overwrite the dummy signature.

    Note: Please configure permissions so that users can upload their own signature image but that others cannot view them. You’ll also want to make sure that only one signature exists for each user.

     

    Create a list to hold the PINs

    1.      Create a Sharepoint Custom List by clicking View All Site Content > Create, and choose Custom List.

     

    2.      Give your custom list a name such as PIN List and choose whether or not you want to add it to the Quick Launch bar. Click Create.

     

    3.      Add a column for a PIN by clicking Settings > Create Column.

     

    4.      For each user, create an item specifying the user’s alias as the Title, and leave PIN blank.

    Figure 7

    5.      Secure each PIN access by only the user who owns the PIN (follow the same procedures as above for protecting the signature images).

     

          6.   Have your users enter their individual PINs.

    Get the ID (GUID) from SharePoint

    Before we edit the data connections, you have to get the ID (GUID) of your SharePoint library and list. To do this, follow the steps below:

    1.   Navigate to your Picture library using the browser.

    2.   Click Settings > Picture Library Settings.

    3.   Click on Audience targeting settings.

    4.   Copy the GUID from the browser address bar. You will need to copy everything after the equal (=) sign.

        

    5.   Paste the GUID in a text editor of your choice. You’ll need them later when editing the data connections.   

    6.   Repeat the same steps for your PIN List library.NOTE: If you don’t have the link “Audience targeting settings” in your SharePoint library/list settings, follow the steps in this blog to decode the GUID.

    Edit the UDC Files

    Electronic Signature UDCX

    1.   Open ElectronicSignatures.udcx that is included in the template part package in any text editor of your choice.

    2.   Find the udc:SelectCommand node and replace the ListId with the GUID of your Electronic Signature picture library.

    3.   Replace the WebUrl with the root URL of your SharePoint site.


     
    4.   Save changes to ElectronicSignatures.udcx.

    PIN List UDCX

    1.   Open PINList.udcx that is included in the template part package in any text editor of your choice.

    2.   Find the udc:SelectCommand node and replace the ListId with the GUID of your PIN List.

    3.   Replace the WebUrl with the root URL of your SharePoint site.


     
    4.   Save changes to PINList.udcx.

    Upload the Data Connection Files to SharePoint

    1.   If you haven’t done so, create a data connection library by going to Site Actions > View All Site Content > Create and choose Data Connection Library.

    2.   Give your data connection library a name such as MyDataConnections, and choose whether or not you want to add it to the Quick Launch bar and create versions. Click Create.

    3.   Click Upload and browse to ElectronicSignatures.udcx, make sure that it’s the file you’ve previously edited. Click OK.

    4.   SharePoint will confirm once the data connection file is successfully uploaded. There is no need to make changes in the next window. Click OK.

    5.   Repeat steps 3-4 to upload PINList.udcx.

    Approve the UDCX Files

    1.   In your data connection library, click the down arrow for ElectronicSignature.udcx and select Approve/ Reject.


     
    2.   Select Approved button and click OK.

    3.   Repeat steps 1-2 to approve PINList.udcx.

    NOTE: The data connection files must be accessible to all users. To make sure all users have access, select the UDCX file and click Manage Permissions. Use the permission tools to grant access to all users or ensure that the active directory group that should have access to the files is added in the list.

    Modify the Template Part

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

    2.   Save as source files.

    a. InfoPath 2007: Click File > Save As Source Files…
    b. InfoPath 2010: Click File > Publish > Export Source Files

    Edit the Data Connections

    1.   Now go to the folder where you saved the source files.

    2.   Find manifest.xsf, right click to it and open in Notepad.

    3.   Find the node called <xsf2:dataConnections>.


     
    4.   Edit the source link of the data connection for PIN List. Make sure that the source value is correct. If you have created the data connection library in the root site, <DataConnectionLibrary>/PINList.udcx should be used. But, if you have your data connection library in a subsite, you should use <subsite>/<DataConnectionLibrary>/PINList.udcx.

    5.   Edit the site collection for PIN List. Make sure to put the link to your SharePoint root site with a forward slash at the end of the link.

    6.   Edit the source link of the data connection for Electronic Signature. Same as the PIN List, make sure that the source value is correct. If you have created the data connection library in the root site, <DataConnectionLibrary>/ElectronicSignatures.udcx should be used. But, if you have your data connection library in a subsite, you should use <subsite>/<DataConnectionLibrary>/ElectronicSignatures.udcx.

    7.   Edit the site collection for Electronic Signature. Make sure to put the link to your SharePoint  root site with a forward slash at the end of the link.


     
    8.   Save the changes to manifest.xsf.

    Edit the Template Part

    1.   Go back to the folder where you saved the source files.

    2.   Open manifest.xsf in InfoPath Design mode.

    3.   In the Main Data source, expand the group called UserInfo and double-click on the LibraryURL field.

    4.   The value for this field is the link to the Electronic Signature library. Change the link to your Electronic Signature library. Don’t forget the slash (/) at the end of the link (e.g. http://<SharePointServer>/<subsite>/ElectronicSignatures/). Once finished, click OK.

    5.   Save As to your local directory, and name the new template part to Qdabra Electronic Signatures.

     

    Add the Template Part to your form

    1.   Open the form where you want to add the Electronic Signature template part.

    2.   At the bottom of the Controls task pane, click Add or Remove Custom Controls.

     

    3.   Click Add.

     

    4.   Select Template Part, click Next.

     

    5.   Browse to the location of the new Qdabra Electronic Signature template part and select the XTP.

     

    6.   Click Finish and Close. Click OK.

     

    7.   Put the cursor in the view where you want to place the Electronic Signature control.

     

    8.   Under Custom Controls, click on the template part to add it to the view.

     

    Test the form

    1.   Click Preview. When asked to connect to data sources, click Yes.

    2.   Enter your PIN and click Sign this document check box.
     
    3.  Your signature should be displayed.

    You can now publish your form to SharePoint and see how cool it is to use electronic signatures!

     

    One Caveat for those of you that want to use this with InfoPath 2007 browser enabled forms: InfoPath 2007 browser forms do not support picture controls (InfoPath 2010 forms do). So, instead of using both the signature picture and the DisplaySignedBy field, you will only be able to use the DisplaySignedBy field. In most cases, this workaround is just fine, since it takes up less room on the page and fits the same purpose.

     

    For your convenience, we are providing the Electronic Signature template part for sale via our Web store. Benefits:

    • Comes with a User Guide that contains in-depth instructions on how to add the rules for validation
    • Saves you time spent creating the XML Template Part. We’ve done it for you.
    • Includes PIN field and rules to check it.
    • Plug-and-play. Just customize the UDC connection and you're ready to go.          

    Purchase the Electronic Signature template part here.

  • Comparing Items in a List against an Updated Data Source

    Data Validation using Code
     

    Data validation using rules doesn’t work for all scenarios. For example, suppose you have a form with a repeating table that is populated from a secondary data source. You save the form and open it a month later and the list is out of date because some of those values in the secondary data source were updated. In this situation, data validation must happen to all nodes in the list, but InfoPath rules don’t easily allow iterating over lists (you can use nested evals but it’s tricky). Even if you could do it, the performance would be horrible, since each item would have to validate itself against the entire secondary data source. What you want is a way to load the new list and compare items to that by first sorting the two lists and then walking them side-by-side. For this kind of data validation, you’re better off just writing some code. This blog shows you how to do data validation with code. 
     

    Our sample form has a repeating table with a “Value” field which looks up values from an external data source. 
     

    Figure1

     

    The typical form will have a data connection to a SharePoint list or a SQL database. To keep things simple for our sample, we’ll use an XML file as our external data source (the same technique can be used with secondary data sources stored as a SharePoint list or as a table in a SQL database). Our secondary data source is a resource file (XML) named “Numbers”, and contains the following data:
     

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

    <Numbers>

         <Number value="1" name="One"/>

         <Number value="2" name="Two"/>

         <Number value="3" name="Three"/>

         <Number value="4" name="Four"/>

         <Number value="5" name="Five"/>

         <Number value="6" name="Six"/>

         <Number value="7" name="Seven"/>

         <Number value="8" name="Eight"/>

         <Number value="9" name="Nine"/>

         <Number value="10" name="Ten"/>

    </Numbers>


     

    Figure2

     

    The Value dropdown in our form looks up the values from the XML external data source: value is the “@value” attribute and display name is the “@name” attribute. Double click on the dropdown and the properties look like this:

     

    Figure3


     

    Previewing the dropdown:


    Figure4

     

    Now, our validation scenario is as follows:

    a)      We open the form, select one or more values and save it as an XML file.

    b)      Later, the external data source changes and one or more values may be removed.

    c)       When opening the old form after this change, wouldn’t it be nice to see some validation telling us that those old values are no longer current? 
     

    Note: You may think that this can be done with InfoPath’s “Open Rules”, but Open Rules run before querying of external data sources, so data validation fails because there are no values loaded from the external data source and all values will show invalid as a result. 
     

    Our solution uses code to perform the validations. The code queries the external data source when the form loads and then walks through the main data sources using an XPath index to see if the main data source value is still in the external data source. If not, an error is added to the InfoPath error board. Later, if a change occurs to the list, we remove the error (since we assume a change must replace the value with a valid value). 
     

    Note: the XPath is not the fastest way to do this. If both lists are sorted, a better solution would be to walk them side-by-side, but that’s more complicated.

     

    using Microsoft.Office.InfoPath;

    using System;

    using System.Windows.Forms;

    using System.Xml;

    using System.Xml.XPath;

    using mshtml;

     

    namespace ValidationInCode

    {

          public partial class FormCode

          {

                private const string VALIDATION_ERROR_NAME = "Invalid";

                private const string VALIDATION_ERROR_MESSAGE = "This value is no longer a valid choice. Please choose a new value.";

     

                public void InternalStartup()

                {

                      EventManager.FormEvents.Loading += new LoadingEventHandler(FormEvents_Loading);

                      EventManager.XmlEvents["/my:myFields/my:Table/my:Value"].Changed += new XmlChangedEventHandler(Value_Changed);

                }

     

                public void FormEvents_Loading(object sender, LoadingEventArgs e)

                {

                      QueryDataSources();

                      PerformValidation();

                }

     

                private void QueryDataSources()

                {

                      // Manually query secondary data source.

                      DataConnection dc = DataConnections["Numbers"];

                      dc.Execute();

                }

     

                public void Value_Changed(object sender, XmlEventArgs e)

                {

                      foreach (FormError error in Errors.GetErrors(VALIDATION_ERROR_NAME))

                      {

                            if (error.Site.IsSamePosition(e.Site))

                            {

                                  Errors.Delete(error);

                                  return;

                            }

                      }

                }

     

                private void PerformValidation()

                {

                      // Get the secondary data source needed for validation.

                      XPathNavigator ds = DataSources["Numbers"].CreateNavigator();

     

                      // Verify all nodes have valid values.

                XPathNodeIterator nodes = MainDataSource.CreateNavigator().Select("/my:myFields/my:Table[my:Value != '']", NamespaceManager);

                      foreach (XPathNavigator node in nodes)

                      {

                             //Get the value node

                     XPathNavigator valueNode = node.SelectSingleNode("my:Value", NamespaceManager);

     

                    // Validate existing selections against a potentially changed data source.

                            XPathNavigator exists = ds.SelectSingleNode("/Numbers/Number/@value[. = '" + valueNode.Value + "']");

                            if (exists == null)

                            {

                                  Errors.Add(valueNode, VALIDATION_ERROR_NAME, VALIDATION_ERROR_MESSAGE);

                            }

                      }

                }

     

          }

    }

     


    At Qdabra, we submit our forms to SQL using our Database Accelerator Web Service Suite (DBXL) which acts as a general suite of Web Services for any form (i.e. Web Service works for any form regardless of the data source). You can also set up Submit to SharePoint and open your form from SharePoint. 
     


    Let’s try out the form.  To simulate what would happen when the external data source is updated, we can fill out the form and type in a bogus value (that we know is not in the valid list of values). Let’s enter a value of “Zero”, insert more items, some exist in the list of values, some don’t, and then submit the form. 

     

    Figure5

      

    When the form opens, we see that the fields, whose values are not in the valid list, are marked invalid. Yay!

     

    Figure6

     

    And after selecting new values, the validation errors are removed. Yippee!

     

    Figure7

     

    Of course, validation is only happening on form load so if the external data source changes while you are editing the form, you could still end up submitting bogus data. So, you’ll want to add a rule to your submit command that calls validation again and interrupts submit if it finds validation issues. We’ll leave it as an exercise to the reader to do this but please send me e-mail if you can’t figure it out after 30 minutes of trying. Hint: Google xdExtension

  • Contact Block Advanced Template Part

    Figure1

     

    The Contact Block Advanced Template Part contains a section for Company information, and a repeating section for Contacts information. This is especially useful if you want to keep a record of contact persons / employees for every company, all in one place.

     

    The Contact Block Advanced Template Part is part of the Qdabra Template Parts package ($25). See all of the template parts included in this package and purchase it here.

     

    This template part is designed to speed up customer lookup using Smart Links.

     

    • Maps – the Address 1 field contains links to lookup the location on Map Quest, Google Maps, and Live Search Maps
    • Visit Website – points to the URL  entered in the Website link
    • Send Mail – launches the default Mail application to send email when the Email field is filled out
    • Skype Call – opens Skype to call up the numbers entered in the Phone and the CellPhone fields.

    Here are some screenshots showing how the Smart Links work:

     

    Google Maps:

     

    GoogleMaps 

     

    Visit Website:

     

    VisitWebsite

     

     

    For you to be able to use it in your forms, you must first install the template part in InfoPath. Here are the steps to do that: 

     

    1.       In InfoPath Design mode, click Controls in the task pane, and scroll down to the Custom section found at the very bottom of the task pane.

    2.       If you haven’t installed any custom controls (like template parts), you will see that the Custom section is empty. Click Add or Remove Custom Controls, and then click Add in the dialog box that appears.

     

    Figure2


    3.       In the Add Custom Control Wizard, select Template Part from the options and click Next.

    4.       Browse to the path of your template part, and click Finish then Close when done.

    5.       The template part will now show in the list of your installed template parts. Click OK to close the dialog box.

     

    Figure3


    6.       After successful installation, the template part will now be available in the Custom section of the Controls task pane (Figure 4).

     

    Figure4


    To use it in your form, just click the template part and it will be shown on InfoPath’s design area (Figure 5). You can then continue designing your form and edit the sections in the template part as necessary.

     

    Figure5

     

    Additional Info:

    If you have added a template part to InfoPath as a custom control, modifying the template part will not change the control. You have to uninstall the current version from your custom controls in InfoPath (using Add or Remove Custom Controls) and then add your new version.

     

    In a real working environment, you must send the updated template part to anyone who is using the original. After the updated template part is installed on each computer, the users are notified that an update is available, thus the need to update the existing forms that are using the template part. 

  • Hide-Show Section Template Part

    I'm sure by now you already have an idea of what template parts are. There have been numerous posts and blog posts describing what template parts can do and how you can use them to make designing your InfoPath forms easier and less time-consuming.

    Speaking of saving time designing forms, wouldn't it be nice to just have a place where you can grab template parts and use them on your forms right away, rather than creating them from scratch? I did a search and found only a few pre-made ones. So I think it would be really good to start compiling these template parts and make them available for everyone to use and just customize as needed.

    Let me show you one good example of a template part that can't be found anywhere. (Believe me, I searched everywhere!) This template part allows you to show or hide sections in your form. It is often useful in forms that have Help sections or those that have a bunch of details that make the form look crowded and untidy.

    This is the Qdabra Hide-Show Section Template Part, which is part of the Qdabra Template Parts package ($25). See all of the template parts included in this package and purchase it here.

    This is what the template part looks like when the section is hidden.  

    Figure1 

    If you wish to expand the section and see the contents, just click on the Show Details link or the down arrow key. 

    Figure2

    For you to be able to use it in your forms, you must first install the template part in InfoPath. Here are the steps to do that:

    1.       In InfoPath Design mode, click Controls in the task pane, and scroll down to the Custom section found at the very bottom of the task pane.

    2.       If you haven’t installed any custom controls (like template parts), you will see that the Custom section is empty. Click Add or Remove Custom Controls, and then click Add in the dialog box that appears.

    Figure 3

    3.       In the Add Custom Control Wizard, select Template Part from the options and click Next.

    4.       Browse to the path of your template part, and click Finish then Close when done.

    5.       The template part will now show in the list of your installed template parts. Click OK to close the dialog box.

    Figure 4

    6.       After successful installation, the template part will now be available in the Custom section of the Controls task pane.  

    Figure 5

    To use it in your form, just click the template part and it will be shown on InfoPath’s design area (Figure 6). You can then continue designing your form and edit the sections in the template part as necessary.

    Figure6 

    Below are the screenshots of the form I have designed using the Hide-Show template part.

    All sections hidden:

    Figure7 

    Showing one of the section’s details:

    Figure8 

    All sections’ details shown:

    Figure9

    Additional Info:

    If you have added a template part to InfoPath as a custom control, modifying the template part will not change the control. You have to uninstall the current version from your custom controls in InfoPath (using Add or Remove Custom Controls) and then add your new version. To do this using the Hide-Show template part, change the placeholder texts so that it can be used specifically for How-to tutorials. 

    Figure10

    Save the template part to the same location it was in when we originally added it as a custom control. Remove the template part from your custom controls in InfoPath (leaving the original control on your form) and add the modified template part to your custom controls. Then, on the same form we created on Step 6, add the template part below the custom control we already had. In Figure 11, the first template part was from the original control, the second after we removed it and re-added it.

    Figure 11

    You can’t simply add the control (template part) again – you will get an error message that it already exists. It has to be removed and re-added.After re-adding the control, you can update the existing template parts that are present on your form by right clicking the old template part and selecting Update. 

    Figure12 

    You will see that the template part in the form has been updated. 

    Figure 13

    In a real working environment, you must send the updated template part to anyone who is using the original. After the updated template part is installed on each computer, the users are notified that an update is available, thus the need to update the existing forms that are using the template part.
  • EnumDB vs. QueryDB

    Qdabra’s Database Enumeration Web Service was introduced on the first version of Qdabra’s Database  Accelerator (DBXL). Up until DBXL v2.1, it was being used by business organizations for their solutions to retrieve data from SQL database tables. Filtering and sorting could also be implemented with the use of additional code. On the other hand, QueryDB Web Service, which was first introduced in DBXL v2.2, provides more advanced features and methods. The built-in operations allow easy filtering and sorting. It’s been proven to work ideally for dynamic queries. Although it needs Qdabra’s Query Builder to successfully generate queries (included for free with DBXL itself), the QueryDB web service is able to complete wider and more conducive tasks.  

    Here are some additional notes to keep in mind:

    • Note that both EnumDB and QueryDB web services require registration of query databases in the web.config file. 
    • If you migrate a document type that has EnumDB connection specified, the SQL Server is preserved when Document Migration Tool (i.e. Document Deployer) is used, while a QueryDB connection requires manual modification.
    • Should you wish to upgrade your DBXL version, and you have an EnumDB connection in your solution, the connection will not break since the web service still exists on newer DBXL versions. 
    The following steps demonstrate the use of EnumDB, particularly to query a specified column in a database table row. In this example, we will query a table with pre-submitted data as shown below: 

    1.      Design a blank InfoPath Form Template.

    2.      From the InfoPath menu, go to Tools > Data Connections.

    3.      Add a data connection that receives data from Database Enumeration Web Service, through the URL: http://<servername>/QdabraWebService/DatabaseEnumerationService.asmx, where <servername> is the name of the machine where DBXL is installed.

    4.      Select GetColumnsForRows from the list of operations. 

    5.      In this example, we will use the values for the parameters as specified below:

    6.      Enter the same values in the next screen.

    7.      Finish the Data Connection Wizard, making sure that the checkbox for Automatically retrieve data when form is opened is unchecked.

    8.      In the Design Tasks pane, click on Controls, and select Text Box.

    9.      Double-click on the text box field that was added onto the view to open the text box properties, and name the field Author.

    10.  Click on the fx button on the right-hand side of the Value field, and insert the field: /dfs:myFields/dfs:queryFields/tns:GetColumnsForRows/tns:filterCriteria/tns:string

    11.  Click OK until all the dialogs are closed.

    12.  Label the text box field as Author.

    13.  Add a button control underneath the Author field, and name it Query.

    14.  Add a rule on this button such that it executes query using the GetColumnsForRows data connection.

    15.  Add a drop-down list box control, and call it Name.

    16.  For the list-box entries, select the option to look up values from the external data source GetColumnsForRows. In the Entries field, select the Xpath /dfs:myFields/dfs:dataFields/tns:GetColumnsForRowsResponse/tns:GetColumnsForRowsResult/Rows/row/Name.

    17.  Click OK until all the dialogs are closed.

    18.  Click Preview to test the form. 

    Notice that the Author field is pre-populated with the value John Smith, as we specified in the data connection. Click on the Query button. 

    The drop-down control should then return a list of data (in this case, Book Names) for the Author specified.

    Change the Author to Jack Thomas, and click Query once again. You should then obtain results as shown below. 

    As you can see, EnumDB is very easy to use if the database table you are querying is small. However, when dealing with lots of data, QueryDB provides much more efficient options, as it allows you to retrieve only a subset of columns, and be able to filter and sort the results.
More Posts « Previous page
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.