cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar
HV0508
Level III

Why doesn't Current Data Table work for me

I am reading a csv file then iam calling current data table on that and it give me error - Argument must contain data table reference in access or evaluation of 'Current Data Table' , Current Data Table/*###*/(dtIVInitial)
Even though the type of dtIVInitial is Table ? What am I doin wrong. Also this doesnt even open a datatable.

// Construct the full paths
initialCSVPath = dataFolderInitial || "/" || initialCSVFile;
finalCSVPath = dataFolderFinal || "/" || finalCSVFile;

// Debugging Output
Show("Matching Initial CSV:", initialCSVPath);
Show("Matching Final CSV:", finalCSVPath);

// Open Files

If( File Exists(initialCSVPath),
Show("Initial file exists");
    dtIVInitial = Open(initialCSVPath,
Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( Tab, Comma, CSV( 1 ) ),
Strip Quotes( 1 ),
Use Apostrophe as Quotation Mark( 0 ),
Use Regional Settings( 0 ),
Scan Whole File( 1 ),
Treat empty columns as numeric( 0 ),
CompressNumericColumns( 0 ),
CompressCharacterColumns( 0 ),
CompressAllowListCheck( 0 ),
Labels( 1 ),
Column Names Start( 1 ),
Data Starts( 2 ),
Lines To Read( "All" )
));
Wait(1.0);
dtIVInitial << Set Name("IV Curves Initial Data");
,
    Throw("Initial IV Curve CSV file not found! Check folder structure.");
);

If( File Exists(finalCSVPath),
Show("Final file exists");
    dtIVFinal = Open(finalCSVPath,
Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( Tab, Comma, CSV( 1 ) ),
Strip Quotes( 1 ),
Use Apostrophe as Quotation Mark( 0 ),
Use Regional Settings( 0 ),
Scan Whole File( 1 ),
Treat empty columns as numeric( 0 ),
CompressNumericColumns( 0 ),
CompressCharacterColumns( 0 ),
CompressAllowListCheck( 0 ),
Labels( 1 ),
Column Names Start( 1 ),
Data Starts( 2 ),
Lines To Read( "All" )
));

Wait(1.0);
dtIVFinal << Set Name("IV Curves Final Data");
,
    Throw("Final IV Curve CSV file not found! Check folder structure.");
);

Show(Type(dtIVInitial));            // "Table"
Show(Type(dtIVFinal));            // "Table"

Show(IsEmpty(dtIVInitial));  
Show(IsEmpty(dtIVFinal));  
Current Data Table(dtIVInitial);
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Why doesn't Current Data Table work for me

What do you need Current Data Table() for? You already have the reference to the table and you can use that instead.

 

Outside of the tip that you shouldn't be using Current data table() in case like this, that syntax should be correct if dtIVInitial is a table. You can just use Show with the dtIVInitial to show what it has

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt1 = Open("$SAMPLE_DATA/Big Class Families.jmp");

show(Current Data Table());
Current Data Table(dt);
show(Current Data Table());

 

 

-Jarmo

View solution in original post

5 REPLIES 5
jthi
Super User

Re: Why doesn't Current Data Table work for me

What do you need Current Data Table() for? You already have the reference to the table and you can use that instead.

 

Outside of the tip that you shouldn't be using Current data table() in case like this, that syntax should be correct if dtIVInitial is a table. You can just use Show with the dtIVInitial to show what it has

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt1 = Open("$SAMPLE_DATA/Big Class Families.jmp");

show(Current Data Table());
Current Data Table(dt);
show(Current Data Table());

 

 

-Jarmo
HV0508
Level III

Re: Why doesn't Current Data Table work for me

I have multiple tables in my script .In  later stages I have to make certain graphs from each table . So I usually set the current table to the one form which i have to make graph from at that time and then make the graph. Not sure if that is the right approach.

jthi
Super User

Re: Why doesn't Current Data Table work for me

That can be very very risky approach. It is better to send the platform message directly to the data table reference if you can easily get it without current data table (this is the case quite commonly). Here is one example with graph builder and distribution with some extra prints to log just to show how the table reference can be utilized

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

gb = dt << Graph Builder(
	Variables(X(:weight), Y(:height), Overlay(:sex)),
	Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
);
dist = dt << Distribution(Column(:Age, :Weight));

nw = New Window("",
	H List Box(
		gb2 = dt << Graph Builder(
			Variables(X(:weight), Y(:height)),
			Elements(Points(X, Y, Legend(9)))
		),
		dist2 = dist = dt << Distribution(Column(:Age));
	)
);

Show(dt, gb, dist, gb << Get Data Table, gb2, dist2);
-Jarmo
HV0508
Level III

Re: Why doesn't Current Data Table work for me

This is nice , i will apply this change in my current code

HV0508
Level III

Re: Why doesn't Current Data Table work for me

Hey @jthi  Thankyou so much for your instant reply. It turns out later in script i was closing the table , hence the issue . 

 

 

Recommended Articles