Compare Strings
Description
Allows two columns to be compared as strings by returning a value of -1, 1, or 0 based on the outcome of the comparison.
Calculation Editor
Options
Input Parameter Values |
Input Values |
Strip Blanks |
Check Box |
Only Rollup If |
Generic Criteria |
Input |
Input Values |
Required |
Input 1 |
Column or Literal |
✔ |
Input 2 |
Column or Literal |
✔ |
- This calculation performs a culture-sensitive and case-sensitive comparison based on your DAS (or JDE) language setting.
- Strip Blanks will remove the blank characters in a column before doing the calculation. For example, the business unit column frequently has leading spaces. If you want those spaces to be maintained in the comparison of values, uncheck the "Strip Blanks" check box.
- The result is a new calculated column where the result is:
Result |
Meaning |
-1 |
Input 1 precedes Input 2 in a sorted list based on culture rules |
0 |
Input 1 equals Input 2 |
1 |
Input 2 precedes Input 1 in a sorted list based on culture rules |
Culture Rules include Alphabetic order, uppercase before lower case, numbers before alpha, punctuation before numbers
Examples
Example 1 (Mismatched Text)
- Inputs: Clothing Incorporated & Clothing Inc.
- Quick Calculations > Text > Compare Strings
- Output: 1
Example 2 (Mismatched Integers)
- Inputs: 17 & 24
- Quick Calculations > Text > Compare Strings
- Output: -1
Example 3 (Matched Text)
- Inputs: Bikers R Us & Bikers R Us
- Quick Calculations > Text > Compare Strings
- Output: 0