Skip to main content
13-Aquamarine
October 28, 2024
Solved

Error org.mozilla.javascript.UniqueTag@3a405ae8: NOT_FOUND when tring to assign to result

  • October 28, 2024
  • 1 reply
  • 879 views

Hi,

I have a service, returning a string, where I send in a comma separated list of values and if I inside a forEach loop try to access a value and assign it as a result I get the error "org.mozilla.javascript.UniqueTag@3a405ae8: NOT_FOUND"

 

Bellow is a code snipped that is addreviated.

 

 

csvInput.trim().split(",").forEach(csv=> {
 var result = csv; // This gives the error

 

 

 I see no reason why it happens, can anyone suggest a fix and explain this error message?

Kindly
Oskar

Best answer by Constantine

Hello Oskar,

 

That  “org.mozilla.javascript.UniqueTag@3a405ae8: NOT_FOUND” is a ThingWorx way of saying that your service returned a JavaScript undefined.


I can’t test it right now, but what likely happens here is that var result gets scoped to the lambda function, and is not visible in the outer scope. Logically you should not be able to redefine a variable in a loop. Try to move it out of the loop:

 
var result = "";

…forEach(csv => { result = csv; });

 

(sorry, can’t format it on the phone)

 

Also, consider using CSV extension for parsing CSV files.

 

/ Constantine

1 reply

18-Opal
October 29, 2024

Hello Oskar,

 

That  “org.mozilla.javascript.UniqueTag@3a405ae8: NOT_FOUND” is a ThingWorx way of saying that your service returned a JavaScript undefined.


I can’t test it right now, but what likely happens here is that var result gets scoped to the lambda function, and is not visible in the outer scope. Logically you should not be able to redefine a variable in a loop. Try to move it out of the loop:

 
var result = "";

…forEach(csv => { result = csv; });

 

(sorry, can’t format it on the phone)

 

Also, consider using CSV extension for parsing CSV files.

 

/ Constantine