cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
PowerOx327
Level I

How do I use the include function to run a separate script which uses an open data table?

Hi all,

 

I've created a script which pulls from SQL and creates a data table as so: 

 


Names Default To Here( 1 );
dtFROMSQL = Execute SQL(
databaseConnectionHandle,
"SELECT HEIGHT, WEIGHT FROM Bigclass",
"NewTable"
);
Include(filepathforsecondscript.jsl);

And then I have another script in my personal folder which adds a column to the data table:

Current Data Table( dtFROMSQL );
dt << New Column( "X", Formula( Random Uniform() ) );

I use an Include function in the first script to run the second script.

 

My problem is that when I try to run it the second script does not detect the data table created in the first script, I get an error like so:

Name Unresolved: dt in access or evaluation of 'dt' , dt/*###*/

 

Any way to get my second script to detect the data table created in the first script?

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
vince_faller
Super User (Alumni)

Re: How do I use the include function to run a separate script which uses an open data table?

Is it not because you're doing 

dt << New Column( "X", Formula( Random Uniform() ) );

instead of 

 

dtFROMSQL << New Column( "X", Formula( Random Uniform() ) );

dt doesn't exist in your top script.  

Vince Faller - Predictum

View solution in original post

3 REPLIES 3
vince_faller
Super User (Alumni)

Re: How do I use the include function to run a separate script which uses an open data table?

Is it not because you're doing 

dt << New Column( "X", Formula( Random Uniform() ) );

instead of 

 

dtFROMSQL << New Column( "X", Formula( Random Uniform() ) );

dt doesn't exist in your top script.  

Vince Faller - Predictum
PowerOx327
Level I

Re: How do I use the include function to run a separate script which uses an open data table?

Yeah it worked. Thanks!

Re: How do I use the include function to run a separate script which uses an open data table?

The first script declares all variables to be in the Here space, local only to that script. The second script uses a variable with the same name, but it is not the same variable. It is either a global variable with the same name or another one defined in the Here name space of the second script.

 

Also, you define the current data table, but not the value stored in the variable dt.