Skip to main content
Solved

Issue parsing JSON from Input value

  • December 12, 2023
  • 2 replies
  • 37 views

Jason_Jakarta
Forum|alt.badge.img+10

Hi,

I've been trying to learn and build a script with the help of ChatGPT. The script creates a report in Clockify and all works fine until I replace the value input variable from a fixed value to a feiled in the base from a previous step. 

The value is just a string but is actually a lookup from another table. I've tried to use a formula in another field and use that but both result in the error seen in the screen shot.

I feel like I'm so close, any advise ?  

Best answer by Jack_Manuel

Looks like you don't need the [] around projectId in your projects filter as it's already an array. Also, not necessary, but if that is the case I would update that variable to be called projectIds as it might help you keep track.

To clarify;

 

//an array of strings with length 1 const projectId = ['abcdefg']; console.log(projectId); //returns ['abcdefg'] console.log([projectId]); returns [['abdcedfg']]

 

2 replies

Jack_Manuel
Forum|alt.badge.img+18
  • Brainy
  • Answer
  • December 12, 2023

Looks like you don't need the [] around projectId in your projects filter as it's already an array. Also, not necessary, but if that is the case I would update that variable to be called projectIds as it might help you keep track.

To clarify;

 

//an array of strings with length 1 const projectId = ['abcdefg']; console.log(projectId); //returns ['abcdefg'] console.log([projectId]); returns [['abdcedfg']]

 


Jason_Jakarta
Forum|alt.badge.img+10
  • Author
  • Known Participant
  • December 13, 2023

Looks like you don't need the [] around projectId in your projects filter as it's already an array. Also, not necessary, but if that is the case I would update that variable to be called projectIds as it might help you keep track.

To clarify;

 

//an array of strings with length 1 const projectId = ['abcdefg']; console.log(projectId); //returns ['abcdefg'] console.log([projectId]); returns [['abdcedfg']]

 


Nice one Jack. Exactly right. Thanks for your help and explanation