Translate filter for most accurate NUMBER


(Hans) #1

Hi, I would like to use the translate filter to identify a match. So I have extracted the first 5 numbers and added this to different fields as per example below. Now I would like to lookup the value starting with the most accurate NUMBER_5 to NUMBER_1; however once a match is found the lookup should stop and write the value to the field.
Example for Number extraction:
Number = 27725883355 NUMBER_1 = 2 NUMBER_2 = 27 NUMBER_3 = 277 NUMBER_4 = 2772 NUMBER_5 = 27725

Translate lookup file example:
“27”: “SA” “277”: “SA_M” “264”: “NA” “1” “US” ….

Current attempt for the filter:
translate { field => "NUMBER_5" destination => "NUMBER_FINAL" dictionary_path => "/etc/DATA.yaml" } translate { field => "NUMBER_4" destination => "NUMBER_FINAL" dictionary_path => "/etc/DATA.yaml" } translate { field => "NUMBER_3" destination => "NUMBER_FINAL" dictionary_path => "/etc/DATA.yaml" } translate { field => "NUMBER_2" destination => "NUMBER_FINAL" dictionary_path => "/etc/DATA.yaml" } translate { field => "NUMBER_1" destination => "NUMBER_FINAL" dictionary_path => "/etc/DATA.yaml" }
With the attempt above the last lookup is returned, while the more accurate one is not returned. The example as follows:
“27”: “SA” “277”: “SA_M”
I would like to have the SA_M returned rather than just SA. Any assistance in getting a solution for this would be greatly appreciated.


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.