Choose Language Hide Translation Bar
Highlighted
rfeick
Level IV

Name Resolved Error Before Variable is Assigned/Used

I have a script whose basic structure is:

generate a few lists that feed the user interface

create user interface

take user input

conduct analysis

I wrote the script using expressions and everything beyond creating the user interface is only called to be run after the user presses the OK button on the user interface

 

The user must select a time range for the analysis which I then import and use as a variable called "days" during the analysis. The only time this variable is defined and used is in the expression to get the user's input to feed into doing the analysis, however when I run the script it will create the user interface and then give a Name Unresolved alert for the days variable even before anything is input by the user. After closing the alert window and entering choices into the user interface the script does seem to run correctly.

 

The variable is defined and then used in a calculation. The alert is happening on the line that uses the variable not the section that defines it. I've dealt with Name Unresolved issues before, but I can't tell why it's popping up before the expression hasn't been called.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
pmroz
Super User

Re: Name Resolved Error Before Variable is Assigned/Used

Sounds like you are using a non-modal window with code after it.  You can either:

1. Switch to a modal window 

nw = new window("test", << modal(),
	tb = text edit box(),
	okb = button box("OK")
	)
);

<post-user-interface steps>

2. Or put logic to be executed by the OK button inside the OK button, maybe with an include.

nw = new window("test",
	tb = text edit box(),
	okb = button box("OK",
		include("post-user-interface.jsl");
	)
);

View solution in original post

2 REPLIES 2
Highlighted
pmroz
Super User

Re: Name Resolved Error Before Variable is Assigned/Used

Sounds like you are using a non-modal window with code after it.  You can either:

1. Switch to a modal window 

nw = new window("test", << modal(),
	tb = text edit box(),
	okb = button box("OK")
	)
);

<post-user-interface steps>

2. Or put logic to be executed by the OK button inside the OK button, maybe with an include.

nw = new window("test",
	tb = text edit box(),
	okb = button box("OK",
		include("post-user-interface.jsl");
	)
);

View solution in original post

Highlighted
rfeick
Level IV

Re: Name Resolved Error Before Variable is Assigned/Used

Thanks! Putting the further code inside the button is just what I was going for. Turns out there was another issue later on in the script that I didn't catch before and was making things more complicated.

Article Labels

    There are no labels assigned to this post.