Help

Extracting Value from Object Variable

Topic Labels: Scripting
Solved
Jump to Solution
1950 2
cancel
Showing results for 
Search instead for 
Did you mean: 
sal
5 - Automation Enthusiast
5 - Automation Enthusiast

Probably a pretty simple script update here but I'm stumped... Everything just comes back as undefined rather than the value 1. 

sal_0-1685486053246.png

 

1 Solution

Accepted Solutions
kuovonne
18 - Pluto
18 - Pluto

I believe @Sho’s explanation will work. 

The issue is that there are two things named inputVariable: the variable you assign the input.config() to, and the input variable that you created in the left panel of the editor. 

You are conflating the two. 
Things would be less confusing if you had only one thing named “inputVariable”. Even better would be to have nothing named “inputVariable”.

Name your input variable in the left panel “boatNumber”, then you can use


const inputConfig = input.config()

const boatNumber = inputConfig.boatNumber

There are other ways to do it, but whatever method you choose, it is best to have meaningful names. 

But also keep in mind that your boat number is actually a text string and not a number.

See Solution in Thread

2 Replies 2
Sho
11 - Venus
11 - Venus

I think you are mistaken
In this case. "inputVariable.inputVariable" will yield "1"

kuovonne
18 - Pluto
18 - Pluto

I believe @Sho’s explanation will work. 

The issue is that there are two things named inputVariable: the variable you assign the input.config() to, and the input variable that you created in the left panel of the editor. 

You are conflating the two. 
Things would be less confusing if you had only one thing named “inputVariable”. Even better would be to have nothing named “inputVariable”.

Name your input variable in the left panel “boatNumber”, then you can use


const inputConfig = input.config()

const boatNumber = inputConfig.boatNumber

There are other ways to do it, but whatever method you choose, it is best to have meaningful names. 

But also keep in mind that your boat number is actually a text string and not a number.