The infer task is similar to a V-lookup in Excel or Google Sheets. Using data in your job and a reference source, look up a value in the reference table by using a relationship between data and data in the reference table.
**The append and infer task templates are similar, click HERE to see which one meets your requirements.
Category Location: All, Frequently Used, Match and lookup
Section 1: What inference mapping to use and How to do the look up and matching
- What inference mapping would you like to use: Select the reference data source
- Matching mode: Select Standard or Advanced (see advanced options screenshot below) #1 Select Advanced #2 Set a number for how many of the criteria must match in order for records to be considered matching. NOTE: When using the Advanced match mode, you can have no more than 5 matching criteria's per set. And you can have no more than 3 matching criteria sets per infer task.
- Compare the input value from: Select the attribute from the input data source to compare
- To the look-up values from: Select the attribute from the reference data source to match to the attribute in #3
- Using the match method of: Options are: Exact match, Fuzzy match, Excludes, Begins with, Ends with or Contains.
- Which inference record to choose if multiple matches found: If the look up and matching section above results in more than one record, this section applies criteria to determine which record to pick. NOTE: If criteria is applied here and no record matches to this criteria, there will be no match found. *best practice is to create a safety net criteria so a record is selected. For instance, createddate is latest/earliest value*
Section 2: What inferred value to output
- Output value from: Choose an attribute from the reference data source to write.
- Output value from custom text: If an attribute is not selected to output in #1, you can set a custom text output by entering text here.
- If more than one match is found: Options are: Write single value without using priority, Write single value using priority, Write single value using counter, Write all matching values ( up to 300), or Write value based on random selection. If selecting to use priority, the reference data source must include a priority column and set as a whole number attribute type for conflict resolution. For details on using the "Write single value using counter" option, refer to Assigning Leads using Even Distribution or "Round Robin" Style
Write output to: Choose an attribute in the input data source to write the inferred value, or select #6 Add Attribute to create a new attribute to house the inferred value.
- Copy unmatched input data to output: Select this checkbox to write the unmatched data to the attribute in #4 Write Output to.
- Add Attribute: Select this to create an attribute for this job.
Section 3: Advanced Configurations
- Do not fail when the reference data source has no data: Select this option to continue with the job if the reference data source has no data. Prevents a job from failing entirely if the reference data source is empty. This is most commonly used when the reference data source used is an output from a job.
- Include additional diagnostic attributes in job output (applies to all Actions): Select this option to output diagnostic attributes for each Action. Use diagnostic outputs to see how a match was made between the reference data source and the input data source on each record.
The OPInferMatchField attribute describes which match method, and fields from the input data source and reference data source that was used to configure the infer value task template. The OPInferredFromSource attribute describes the name of the reference data source that was used to configure the infer value task template. The numbers at the end of each attribute correspond with the Action.
If you are using Standard match mode, OPInferMatchFields will list "Standard" at the beginning of the output value.
If you are using Advanced match mode, OPInferMatchFields will list "Advanced" at the beginning of the output value, and indicate the minimum number of criteria's configured in the task template.
- Filter Reference Data: Use this option to filter the reference data.
- Allow match on blanks : Select this option to enable blank matching on the identified attributes. Each Criteria will be listed. NOTE: Match on blank will work if the input data source value is blank and the reference is populated OR if both the input data source value and reference value is blank. It will not match records where the input data source is populated and the reference is blank. Additionally, please note that if both are blank and multiple records in the reference are blank, it will pick the first record it finds as a match. Matching on multiple criteria in this instance is recommended.
- Case Sensitive: Select this option to match attributes for each criteria based on case sensitivity.
- This task requires the use of a Reference Data Source that contains the relationships between attribute A and attribute B. For example, the Openprise reference Reference – States, Provinces, Regions contains state and country relationships. This can be used to infer missing country information if the state information is available.
- Matching can be done on multiple attributes, eg. infer a value for attribute A by matching on attributes B1, B2, B3, … etc.
- You can output more than one attribute, and you can also output custom text.
- It is best not to overwrite the existing value in Attribute A, so instead use a filter for attribute A = Has no value to infer a value for attribute A only if it is empty, or write the results to a new attribute.
PLEASE NOTE: If you have 2 actions that write back (output value) to the SAME field, there is no guarantee that the actions are evaluated in order. Therefore the second action can overwrite the first, or the first action can overwrite the second.
- For Example: Let's assume that Action 1 is evaluated before Action 2. If Action 1 matches on City & State and writes to the 0P Country field AND Action 2 matches on City, State and Postal Code fields and writes to the 0P Country field, the value retained in the 0P Country field will be from Action 2. However, if Action 2 finds no match, the value from Action 1 will be retained.
Infer missing country attribute if there is recognizable state value.
- For example, if State = "California", then infer Country = "United States".
- Use the Openprise reference Reference – States, Provinces, Regions.
Infer missing postal code from a known city and state data.
- For example, if City = "Redwood City" and State = "California", then infer Postal Code = "94065".
- Use the Openprise reference Reference – US ZIP Codes.
Openprise has a special value that can be used in reference tables along with the Infer value task to perform wildcard matching. The value is “OP_MATCH_ANY”. This value works with String, Number and Boolean field types. The following example illustrates how this feature is used.
Example: Suppose I want to assign a score using State and City. When State = NY, and City = New York, I want to assign a score of 2. For all other cities where State = NY, I want to assign a score of 1.
- Begin by creating a Data Source reference table, with the contents as shown below. I've named my reference Data Source “Infer Value OP_MATCH_ANY”. Remember to import the data after you create the Data Source definition.
Note the use of "OP_MATCH_ANY", which is a special value that allows wildcard matching.
- Then, I create a Task that uses the Infer value task template and looks like this:
NOTE: I have configured the Advanced Configuration section to allow matching on blanks for "Matching Criteria 2" which is the "City" match. This is to ensure that a score of 1 is set for a City that is blank but State that is NY. Without that checkbox, we will only assign a score of 1 if the State is NY and City has any value other than New York or blank.
- The result of running the above Task is shown below. You can see that Openprise will prioritize a full match of both criteria over a wildcard match, thus achieving the results desired.