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
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
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
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
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)
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