Form design notes - address validation

Once the InfoPath Form has been generated from Designer (see Workflow design notes), then you will be able to configure input parameters for the Address Doctor Web service.

Address Inputs

Only fields listed below were configured, and others have been left as blank.

Note: See section 5.5 of Address Doctor's Web Service (SOAP) documentation (.PDF file) for more details on setting parameters.

The folders appear in the form under a folder with the group name (Address) (see below)

The lists below are recommended default values to be set for this example. Follow these steps for each field:

  1. Right-click on each field from the view (see above), and then click Properties.
  2. In the Field or Group Properties dialog box, add the default Value (see the table below for default values) for the field.
  3. Click OK.

The recommended default values or this example are listed in the following table.

Field or Group Properties

Field

Default Value

Location: Address_Input\addInteractiveRequest\Authentication

CustomerID

The userID

Password

(userID's password)

Location: Address_Input\addInteractiveRequest\Parameters\

CountryofOrigin

COO_ALWAYS_USE_DESTINATION_COUNTRY

StreetWithHNo

FALSE

CountryType

ISO_2 (Note: SAP uses only 2 digits for Country Code)

LineSeparator

LST_LF

PreferredLanguage

PFL_LANG_EN

Capitalization

NO_CHANGE

FormattedAddresswithOrganization

FALSE

RemoveDiacritics

TRUE

Location: Address_Input\addInteractiveRequest\Address

The following should be mapped or set to equal the corresponding fields in the form that the user fills in. These are the address fields that the web service will validate.

  • Street
  • House number
  • Locality=City
  • PostalCode
  • Province = State/Region
  • Country
  • DeliveryAddressLines=Street

 

Address Outputs

The example below shows the address validation service in the form. The table following the image lists the fields that were mapped to a repeating table for the Search output.

Design Patterns - Address Validation

Note: You will need to manually add a field as shown above by the check box under select- this allows the user to pick which address they want to use based on the results. To do this right-click on the folder you want to add the field to and click Add

Mapped Fields

Folder

Location

Notes

FormattedAddress_2

Address_Output\ValidateResult\Results\Result\Address_1

This provides the full address in a single field, making it easier for the user to see the full address and make a selection.

ResultPercentage

Address_Output\ValidateResul\Result\Result

This returns a percentage of how well the address matches the results returned.

Results Count

Address_Output\ValidateResult

This returns the number of addresses returned.

This is optional, but it can be useful. It should not be used in the repeating table because there is only one value for the results. It is shown above the repeating table in this example.

Creating a rule

In the following section, you will add a rule to fill in the address fields based on the users selection (the 'Select' checkbox in the Address Validation screen shown above).

The rule should be applied when the check box is selected (i.e TRUE), and trigger an Action rule that will set the following fields. These can be also the same fields that you choose to validate. Once the validation finishes, you can overwrite the fields with the validated data.

Note: Although the output shows the complete address in one field (FormattedAddress_2) you will probably need to use individual fields to set the address in your form because SAP stores data in different fields. These can be also the same fields that you choose to validate. Once the validation finishes, you can overwrite the fields with the validated data.

To set the fields, do the following.

  1. In InfoPath, add a rule.
  2. Next to Run these actions, click Add.
  3. Click Set a field's value
  4. In the Run Details dialog box, next to Field, click InfoPath field browse icon, and then select the field in the form that you want to be overwritten or updated by the results next to the 'Select' checkbox.
  5. Click the Formula button, and then click Insert Field or Group.
  6. Select the field from the results of the web service field that matches the field in the previous step (in this case, HouseNumber_1.)

BPG - Design Patterns - Form design notes - address validation - creating rule

BPG - Design Patterns - Form design notes - address validation - rule details

The following fields are recommended to be set based on this rule. Repeat the steps above for each field in the following list.

Note: You only need one rule, and you can set as many fields based on the rule as required.

The following fields are all located under Address_Output\ValidateResult\Results\Result\Address

Field

Notes

House Number

House Number field that the form will use to update SAP

Street

Street field that the form will use to update SAP

Locality

City field that the form will use to update SAP

PostalCode

Postal code field that the form will use to update SAP

Province

State/Region field that the form will use to update SAP

Country

Country field that the form will use to update SAP

Create a button to call the Web Service

With the Web service added and the fields mapped and configured, all that is left is to add a button to the form so users can click it and validate an address they have entered.

In InfoPath:

  1. Add the WS.Web Service control to your form where you want the button to be located.
  2. Right-click the Web service button, and then select WS.Web Service Properties
  3. On the Data tab, enter a name for the button (for example, Validate)
  4. On the Web Service tab, click Add, and then select the Address Web Service.
  5. Check When button is pressed, and then type the name (Address Validation) for the button. (This is the name that appears on the actual button in the form.)
  6. Click OK