question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to access variable in for loop

See original GitHub issue

I’m trying to create a reverse lookup table based on another variable, but it fails with a “No such variable” error.

Example JSLT that I expected to return the string “dk”:

let lookup = {
  "dk" : "Denmark",
  "se" : "Sweden"
}
let reverse = {for ($lookup) .value : .key}
get-key($reverse, "Denmark")

If I comment out the call to optimizeLets on line 123 of ExpressionImpl.java it works as expected.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
larsgacommented, May 29, 2019

Sure! I’ll try to get it done during the weekend.

I may try to sneak in PR #72 and also implement issue #56.

0reactions
fredrivcommented, May 29, 2019

@larsga Any chance for a release with this fix? 😃 We’re hitting this in another case now, where we don’t have a workaround currently.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot Access Variable inside the for loop - Stack Overflow
I'm trying to concatenate string values from clientGroupList to make a string variable. I cannot access to the returned variable.
Read more >
Why can't I access the variable value after a loop - New to Julia
Hi, I use Pluto to run Julia, but I have a problem wanting to get the value of the variable x_t1 out of...
Read more >
Variable Scope | Fix error: 'yourVariable' was not declared in ...
We've got a function called setup and we have a function called loop. If I create a variable inside setup I can't use...
Read more >
SyntaxError: a declaration in the head of a for-of loop can't ...
The head of a for...of loop contains an initializer expression. That is, a variable is declared and assigned a value for (const i...
Read more >
Unable to access variable outside loop
I am unable to access the value set inside the loop from outside loop . Thought of taking this to forum , I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found