How to use a globalMap variable in a tMatchGroup's "Match Threshold"

Four Stars

How to use a globalMap variable in a tMatchGroup's "Match Threshold"

Hi,
I want to use a variable stored in the globalMap to set the "Match Threshold" area of a tMatchGroup
The variable is of type String(comma is used for decimal separation), so I am creating a brand new Double variable in a tJava, right before the tMatchGroup like this:
   String x = globalMap.get("MatchTreshold").toString();
   x = x.replace(",", ".");    // Replace the French comma by a dot
   globalMap.put("MatchTresholdDouble", Double.parseDouble(x));

   System.out.println("MatchTresholdDouble: " + globalMap.get("MatchTresholdDouble"));  // displays the correct value
I tried both

globalMap.get("MatchTresholdDouble")
Double.parseDouble(globalMap.get("MatchTresholdDouble"))

In the "Match Threshold" area of the tMatchGroup but, when running the job,  the error message is always:
mdm_produit.job_chrg_tbl_ref_udc_stef_v4_0_1.Job_Chrg_Tbl_REF_UDC_Stef_V4 - tMatchGroup_1_GroupIn All attribute matcher weights are 0. This is an invalid setting!
Am I right to think that Talend expects a Double there and could you please provide the correct syntax?
Thanks,
Stéphan
Seventeen Stars

Re: How to use a globalMap variable in a tMatchGroup's "Match Threshold"

Hard to say, perhaps it is a timing problem. Could you provide here the screenshot of the job?
Four Stars

Re: How to use a globalMap variable in a tMatchGroup's "Match Threshold"

Thanks for your help jlolling
I am having a hard time uploading the screenshot ("Error : The server was unable to save the uploaded file. Please contact the forum administrator at" message).  I will ask a colleague to try!
My colleague is also unable to upload the screenshot.  Would you mind if I sent it to you by your gmail account?  Thanks
Four Stars SAQ
Four Stars

Re: How to use a globalMap variable in a tMatchGroup's "Match Threshold"

Hi, here is the screenshot.
Four Stars

Re: How to use a globalMap variable in a tMatchGroup's "Match Threshold"

The server will still not allow us to upload screenshots.  Since the message stops at: "Error : The server was unable to save the uploaded file. Please contact the forum administrator at", I simply do not know who to contact....
Anyways, a tMatchGroup's "Match Threshold" area accepts only values.  They can be with or without quotes like "0.85" or 0.85.
But if you try to type in any java command like Double.valueOf("0.85"); or any variable name, the error message is:
Exception in component tMatchGroup_1_GroupIn
java.lang.NumberFormatException: For input string: "Double.valueOf(0.85);"
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at sun.misc.FloatingDecimal.parseDouble(Unknown Source)
at java.lang.Double.parseDouble(Unknown Source)
at java.lang.Double.valueOf(Unknown Source)
at org.talend.dataquality.record.linkage.grouping.AbstractRecordGrouping.createRecordMatcher(AbstractRecordGrouping.java:545)
It seems like whatever you type in there is treated as a String, even if it is a variable name or a call to a Java method!
I believe someone else had a similar issue here: https://jira.talendforge.org/browse/TDQ-9429
but I cannot tell what the solution was
P.S.: I made a mistake in a previous reply: Error message All attribute matcher weights are 0  was my own fault... Sorry
Four Stars

Re: How to use a globalMap variable in a tMatchGroup's "Match Threshold"

Found this workaround:
Since an exception occurs when trying to set the "Match Threshold" area of a tMatchGroup with globalMap.get("matchThreshold"):
   Exception in component tMatchGroup_1_GroupIn java.lang.NumberFormatException: For input string: "globalMap.get(matchThreshold)"

I tried adding a String variable to the Context and use context.matchThreshold to set the "Match Threshold" area and it worked!!!
I did not even have to cast the String into a Double
I can't tell you why (even if I do not trust the double quotes of globalMap.get()...) but don't waste too much time with globalMap.get and use a context instead (version 6.0)
One Star

Re: How to use a globalMap variable in a tMatchGroup's "Match Threshold"

HI,
i had the same problem because i want to put context.myVariable instead of a value
Talend sent me a patch to accept context variable BUT after i try tu put globalMap.get("variable")  and i met the same mistake
the patch just accept a value or read the value by recognizing context.VARIABLE . . . thanks beautiful patch
i was in Talend MDM 5.6.1

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Have you checked out Talend’s 2019 Summer release yet?

Find out about Talend's 2019 Summer release

Blog

Talend Summer 2019 – What’s New?

Talend continues to revolutionize how businesses leverage speed and manage scale

Watch Now

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog