cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
lala
Level VIII

How does text format content get in memory without repetition?

Like this first column:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Add Rows( 1, after( N Row( dt ) ) );
dt[N Rows( dt ), 1] = dt[1, 1];

ar = dt << GetAsMatrix( 1 );nn = Matrix( Associative Array( ar[0, 1] ) << getKeys );//??

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How does text format content get in memory without repetition?

Use Summarize()

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Add Rows(1, after(N Row(dt)));
dt[N Rows(dt), 1] = dt[1, 1];

Summarize(dt, uniq = By(Column(dt, 1)));

show(uniq);

or associative array()

Associative Array(Column(dt, 1)) << get keys

or create summary table and get values from there

dt_summary = dt << Summary(
	Group(Column(dt, 1)),
	Freq("None"),
	Weight("None"),
	Link to original data table(0),
	private
);

a = dt_summary[0, 1];
Close(dt_summary, No save);
show(a);

All of these have their own use cases

-Jarmo

View solution in original post

3 REPLIES 3
jthi
Super User

Re: How does text format content get in memory without repetition?

Use Summarize()

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Add Rows(1, after(N Row(dt)));
dt[N Rows(dt), 1] = dt[1, 1];

Summarize(dt, uniq = By(Column(dt, 1)));

show(uniq);

or associative array()

Associative Array(Column(dt, 1)) << get keys

or create summary table and get values from there

dt_summary = dt << Summary(
	Group(Column(dt, 1)),
	Freq("None"),
	Weight("None"),
	Link to original data table(0),
	private
);

a = dt_summary[0, 1];
Close(dt_summary, No save);
show(a);

All of these have their own use cases

-Jarmo
lala
Level VIII

Re: How does text format content get in memory without repetition?

Thanks Experts!

Can a list already in memory be filtered by a similar function?

a1={"A","B","C","D","E","B","C","D","E"};
jthi
Super User

Re: How does text format content get in memory without repetition?

All of the same methods work, but for summary/summarize you have to first create a data table. For associative array it is more simple Scripting Guide > Data Structures > Associative Arrays in JSL Scripts > Create Associative Arrays 

Names Default To Here(1);

a1 = {"A", "B", "C", "D", "E", "B", "C", "D", "E"};

a2 = Associative Array(a1) << get keys;
-Jarmo