cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
%3CLINGO-SUB%20id%3D%22lingo-sub-718508%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%EB%A3%A8%ED%94%84%EC%97%90%EC%84%9C%20%EC%88%98%EC%A7%81%EC%9C%BC%EB%A1%9C%20%EC%97%B0%EA%B2%B0%ED%95%98%EB%8A%94%20%EB%8F%99%EC%95%88%20%EB%A9%94%EB%AA%A8%EB%A6%AC%20%EC%A0%88%EC%95%BD%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-718508%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%EC%9D%B8%EC%82%AC%EB%A7%90!%3C%2FP%3E%3CP%3E%EB%94%94%EB%A0%89%ED%84%B0%EB%A6%AC%EC%97%90%20%EC%9E%88%EB%8A%94%20%EC%97%AC%EB%9F%AC%20%ED%85%8C%EC%9D%B4%EB%B8%94%EC%9D%98%20%EC%BF%BC%EB%A6%AC%20%EA%B2%B0%EA%B3%BC%EB%A5%BC%20%ED%95%98%EB%82%98%EC%9D%98%20%EB%8B%A8%EC%9D%BC%20%ED%85%8C%EC%9D%B4%EB%B8%94%EB%A1%9C%20%EC%97%B0%EA%B2%B0%ED%95%98%EB%A0%A4%EA%B3%A0%20%ED%95%A9%EB%8B%88%EB%8B%A4.%20%EB%A3%A8%ED%94%84%EB%A5%BC%20%EC%82%AC%EC%9A%A9%ED%95%98%EC%97%AC%20%ED%85%8C%EC%9D%B4%EB%B8%94%EC%9D%84%20%EC%9D%BD%EA%B3%A0%20%EC%BF%BC%EB%A6%AC%ED%95%98%EA%B3%A0%20%EA%B2%B0%EA%B3%BC%EB%A5%BC%20%EC%97%B0%EA%B2%B0%ED%95%98%EA%B3%A0%20%EC%9E%88%EC%8A%B5%EB%8B%88%EB%8B%A4.%20%EA%B2%B0%EA%B3%BC%20%ED%85%8C%EC%9D%B4%EB%B8%94%EC%9D%80%20%EC%96%91%ED%98%B8%ED%95%98%EC%A7%80%EB%A7%8C%20%EA%B0%81%20%EC%A4%91%EA%B0%84%20%EC%97%B0%EA%B2%B0%20%ED%85%8C%EC%9D%B4%EB%B8%94%EC%9D%B4%20%EA%B3%84%EC%86%8D%20%EC%97%B4%EB%A0%A4%20%EB%A9%94%EB%AA%A8%EB%A6%AC%EB%A5%BC%20%EC%86%8C%EB%AA%A8%ED%95%A9%EB%8B%88%EB%8B%A4.%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CP%3E%EA%B0%81%20%EC%A4%91%EA%B0%84%20%EA%B2%B0%EA%B3%BC%20%ED%85%8C%EC%9D%B4%EB%B8%94%EC%9D%84%20%EC%97%B4%EC%A7%80%20%EB%A7%90%EA%B3%A0%20%EB%A3%A8%ED%94%84%EA%B0%80%20%EC%99%84%EB%A3%8C%EB%90%9C%20%ED%9B%84%EC%97%90%EB%A7%8C%20%EA%B2%B0%EA%B3%BC%20%ED%85%8C%EC%9D%B4%EB%B8%94%EB%A1%9C%20%ED%91%9C%EC%8B%9C%EB%90%A0%20%EC%88%98%20%EC%9E%88%EB%8A%94%20%EB%8D%B0%EC%9D%B4%ED%84%B0%20%ED%94%84%EB%A0%88%EC%9E%84%EC%9D%84%20%EC%97%85%EB%8D%B0%EC%9D%B4%ED%8A%B8%ED%95%98%EB%9D%BC%EB%8A%94%20%EC%A0%9C%EC%95%88%EC%9D%84%20%EB%B3%B4%EB%82%B4%EC%A3%BC%EC%85%94%EC%84%9C%20%EA%B0%90%EC%82%AC%ED%95%A9%EB%8B%88%EB%8B%A4.%3CBR%20%2F%3E%3CBR%20%2F%3E%20JMP%2017%20Pro%EB%A5%BC%20%EC%82%AC%EC%9A%A9%ED%95%98%EA%B3%A0%20%EC%9E%88%EC%8A%B5%EB%8B%88%EB%8B%A4.%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Enames%20default%20to%20here(1)%3B%3CBR%20%2F%3EdirLoc%3DPick%20Directory(%22Select%20a%20directory%22%2C%20%22myDirectory%5C%22)%3B%0AfileList%20%3D%20Files%20In%20Directory(dirLoc)%3B%0Adt1%20%3D%20open(dirLoc%20%7C%7C%20fileList%5B1%5D)%3B%0Adt1%20%26lt%3B%26lt%3B%20Select%20Where(%20%3AAmount%20%26gt%3B%3D%20500%20)%3B%0Ax%3Ddt1%20%26lt%3B%26lt%3B%20Subset%20(%20Output%20Table%20Name(%22T1%22)%20)%3B%0AClose(dt1%2C%20NoSave)%3B%0AFor(i%20%3D%202%2C%20i%20%26lt%3B%3D%20N%20Items(%20fileList%20)%2C%20i%2B%2B%2C%0A%09dt%20%3D%20open(dirLoc%20%7C%7C%20fileList%5Bi%5D%20)%3B%0A%09dt%20%26lt%3B%26lt%3B%20Select%20Where(%20%3AAmount%20%26gt%3B%3D%20500%20)%3B%0A%09y%20%3D%20dt%20%26lt%3B%26lt%3B%20Subset%20(%20Output%20Table%20Name(%22Temp%22))%3B%0A%09x%20%3D%20x%20%26lt%3B%26lt%3B%20Concatenate(%20y)%3B%0A%09Close(dt%2C%20NoSave)%3B%0A%09Close(y%2C%20NoSave)%3B%0A)%3B%0Aresult%20%3D%20x%26lt%3B%3CSUBSET%3E%3C%2FSUBSET%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%20%3C%2FCODE%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%3CLINGO-LABS%20id%3D%22lingo-labs-718508%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3E%EC%9E%90%EB%8F%99%ED%99%94%20%EB%B0%8F%20%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8C%85%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3C%2FCODE%3E%3CLINGO-SUB%20id%3D%22lingo-sub-718539%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20%EB%A3%A8%ED%94%84%EC%97%90%EC%84%9C%20%EC%88%98%EC%A7%81%EC%9C%BC%EB%A1%9C%20%EC%97%B0%EA%B2%B0%ED%95%98%EB%8A%94%20%EB%8F%99%EC%95%88%20%EB%A9%94%EB%AA%A8%EB%A6%AC%EB%A5%BC%20%EC%A0%88%EC%95%BD%ED%95%A9%EB%8B%88%EB%8B%A4.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-718539%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThere%20might%20be%20some%20misunderstanding%20here.%20%20Doing%20%3CCODE%20class%3D%22%20language-jsl%22%3Ex%20%26lt%3B%26lt%3B%20Concatenate(%20x%2C%20y%20)%3C%2FCODE%3E%20will%20not%20update%20%3CCODE%20class%3D%22%20language-jsl%22%3Ex%3C%2FCODE%3E%2C%20it%20will%20create%20a%20new%20table.%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CP%3ETo%20update%20%3CCODE%20class%3D%22%20language-jsl%22%3Ex%3C%2FCODE%3E%20with%20the%20values%20of%20%3CCODE%20class%3D%22%20language-jsl%22%3Ey%3C%2FCODE%3E%2C%20use%20the%20literal%20expression%20%3CCODE%20class%3D%22%20language-jsl%22%3Ex%20%26lt%3B%26lt%3B%20Concatenate(%20y%2C%20%22Append%20to%20First%20Table%22%20)%3C%2FCODE%3E%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CP%3E%EB%98%90%ED%95%9C%20%EB%A6%AC%EC%86%8C%EC%8A%A4%EB%A5%BC%20%EC%A0%88%EC%95%BD%ED%95%98%EA%B8%B0%20%EC%9C%84%ED%95%B4%20%EC%9D%B4%20%EB%AA%A8%EB%93%A0%20%EC%9E%91%EC%97%85%EC%9D%84%20%EB%B9%84%EA%B3%B5%EA%B0%9C%20%ED%85%8C%EC%9D%B4%EB%B8%94%EB%A1%9C%20%EC%88%98%ED%96%89%ED%95%9C%20%EB%8B%A4%EC%9D%8C%20%EB%A7%88%EC%A7%80%EB%A7%89%EC%97%90%20%EB%8B%A4%EC%9D%8C%EA%B3%BC%20%EA%B0%99%EC%9D%B4%20%ED%85%8C%EC%9D%B4%EB%B8%94%EC%9D%84%20%ED%91%9C%EC%8B%9C%ED%95%98%EB%8A%94%20%EA%B2%83%EC%9D%84%20%EA%B3%A0%EB%A0%A4%ED%95%B4%EB%B3%B4%EC%84%B8%EC%9A%94.%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(%201%20)%3B%0AdirLoc%20%3D%20Pick%20Directory(%20%22Select%20a%20directory%22%2C%20%22myDirectory%5C%22%20)%3B%0AfileList%20%3D%20Files%20In%20Directory(%20dirLoc%20)%3B%0Adt1%20%3D%20Open(%20dirLoc%20%7C%7C%20fileList%5B1%5D%2C%20Private%20)%3B%0Adt1%20%26lt%3B%26lt%3B%20Select%20Where(%20%3AAmount%20%26gt%3B%3D%20500%20)%3B%0Ax%20%3D%20dt1%20%26lt%3B%26lt%3B%20Subset(%20Output%20Table%20Name(%20%22T1%22%20)%2C%20Private%20)%3B%0AClose(%20dt1%2C%20NoSave%20)%3B%0A%0AFor(%20i%20%3D%202%2C%20i%20%26lt%3B%3D%20N%20Items(%20fileList%20)%2C%20i%2B%2B%2C%0A%09dt%20%3D%20Open(%20dirLoc%20%7C%7C%20fileList%5Bi%5D%2C%20Private%20)%3B%0A%09dt%20%26lt%3B%26lt%3B%20Select%20Where(%20%3AAmount%20%26gt%3B%3D%20500%20)%3B%0A%09y%20%3D%20dt%20%26lt%3B%26lt%3B%20Subset(%20Output%20Table%20Name(%20%22Temp%22%20)%2C%20Private%20)%3B%0A%09x%20%26lt%3B%26lt%3B%20Concatenate(%20y%2C%20%22Append%20to%20First%20Table%22%20)%3B%0A%09Close(%20dt%2C%20NoSave%20)%3B%0A%09Close(%20y%2C%20NoSave%20)%3B%0A)%3B%0A%0Ax%20%26lt%3B%26lt%3B%20Set%20Name(%20%22Result%22%20)%3B%0Ax%20%26lt%3B%26lt%3B%20New%20Data%20View%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%20%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-718526%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20%EB%A3%A8%ED%94%84%EC%97%90%EC%84%9C%20%EC%88%98%EC%A7%81%EC%9C%BC%EB%A1%9C%20%EC%97%B0%EA%B2%B0%ED%95%98%EB%8A%94%20%EB%8F%99%EC%95%88%20%EB%A9%94%EB%AA%A8%EB%A6%AC%EB%A5%BC%20%EC%A0%88%EC%95%BD%ED%95%A9%EB%8B%88%EB%8B%A4.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-718526%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%EC%97%B0%EA%B2%B0%20%EB%8C%80%EC%8B%A0%20%EC%B6%94%EA%B0%80%ED%95%98%EB%8F%84%EB%A1%9D%20%EC%A0%9C%EC%95%88%ED%95%B4%20%EC%A3%BC%EC%85%94%EC%84%9C%20%EA%B0%90%EC%82%AC%ED%95%A9%EB%8B%88%EB%8B%A4.%20%EC%8B%A4%EC%A0%9C%EB%A1%9C%20%EC%95%84%EB%9E%98%EC%99%80%20%EA%B0%99%EC%9D%B4%20%EC%B6%94%EA%B0%80%EB%A5%BC%20%EC%8B%9C%EB%8F%84%ED%96%88%EC%8A%B5%EB%8B%88%EB%8B%A4.%20%EB%AC%B8%EC%A0%9C%EB%8A%94%20%EB%A3%A8%ED%94%84%EC%97%90%20%EC%B6%94%EA%B0%80%EB%90%A0%20%EB%95%8C%EB%A7%88%EB%8B%A4%20%EB%AA%A8%EB%93%A0%20%EC%A4%91%EA%B0%84%20%ED%85%8C%EC%9D%B4%EB%B8%94%EC%9D%B4%20%ED%8C%9D%EC%97%85%EB%90%9C%EB%8B%A4%EB%8A%94%20%EA%B2%83%EC%9E%85%EB%8B%88%EB%8B%A4.%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Ex%20%26lt%3B%26lt%3B%20Concatenate(x%2Cy)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%EC%96%B4%EB%96%A4%20%EC%83%9D%EA%B0%81%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-718525%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20%EB%A3%A8%ED%94%84%EC%97%90%EC%84%9C%20%EC%88%98%EC%A7%81%EC%9C%BC%EB%A1%9C%20%EC%97%B0%EA%B2%B0%ED%95%98%EB%8A%94%20%EB%8F%99%EC%95%88%20%EB%A9%94%EB%AA%A8%EB%A6%AC%EB%A5%BC%20%EC%A0%88%EC%95%BD%ED%95%A9%EB%8B%88%EB%8B%A4.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-718525%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%EC%97%B0%EA%B2%B0%EB%90%9C%20%ED%85%8C%EC%9D%B4%EB%B8%94%EC%9D%84%20%EC%B6%94%EA%B0%80%ED%95%B4%EC%95%BC%20%ED%95%A9%EB%8B%88%EB%8B%A4.%20%EA%B8%B0%EB%B3%B8%EC%A0%81%EC%9C%BC%EB%A1%9C%20JMP%EB%8A%94%20%ED%85%8C%EC%9D%B4%EB%B8%94%EC%9D%84%20%EC%83%88%20%ED%85%8C%EC%9D%B4%EB%B8%94%EB%A1%9C%20%EC%97%B0%EA%B2%B0%ED%95%A9%EB%8B%88%EB%8B%A4.%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Enames%20default%20to%20here(1)%3BdirLoc%3DPick%20Directory(%22Select%20a%20directory%22%2C%20%22myDirectory%5C%22)%3B%0AfileList%20%3D%20Files%20In%20Directory(dirLoc)%3B%0Adt1%20%3D%20open(dirLoc%20%7C%7C%20fileList%5B1%5D)%3B%0Adt1%20%26lt%3B%26lt%3B%20Select%20Where(%20%3AAmount%20%26gt%3B%3D%20500%20)%3B%0Ax%3Ddt1%20%26lt%3B%26lt%3B%20Subset%20(%20Output%20Table%20Name(%22T1%22)%20)%3B%0AClose(dt1%2C%20NoSave)%3B%0AFor(i%20%3D%202%2C%20i%20%26lt%3B%3D%20N%20Items(%20fileList%20)%2C%20i%2B%2B%2C%0A%09dt%20%3D%20open(dirLoc%20%7C%7C%20fileList%5Bi%5D%20)%3B%0A%09dt%20%26lt%3B%26lt%3B%20Select%20Where(%20%3AAmount%20%26gt%3B%3D%20500%20)%3B%0A%09y%20%3D%20dt%20%26lt%3B%26lt%3B%20Subset%20(%20Output%20Table%20Name(%22Temp%22))%3B%0A%09x%20%26lt%3B%26lt%3B%20Concatenate(%20y%2C%20%22Append%20to%20First%20Table%22%20)%3B%0A%09Close(dt%2C%20NoSave)%3B%0A%09Close(y%2C%20NoSave)%3B%0A)%3B%0Aresult%20%3D%20x%26lt%3B%3CSUBSET%3E%3C%2FSUBSET%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%20%20%3C%2FCODE%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
monir
Level I

Save memory while Concatenating vertically in loop

Greetings!

I am trying to Concatenate query results, from several tables in a directory, into one single table. I am using loop to read/query the tables and concatenate the results. The result table is fine but each intermediate concatenated tables keeps opening consuming the memory. 

 

Thank you for any suggestions to to avoid opening each intermediate result tables but just updating the data frame which can be displayed as the result table only after the loop is completed.

I am using JMP 17 Pro. 

 

names default to here(1);
dirLoc=Pick Directory("Select a directory", "myDirectory\"); fileList = Files In Directory(dirLoc); dt1 = open(dirLoc || fileList[1]); dt1 << Select Where( :Amount >= 500 ); x=dt1 << Subset ( Output Table Name("T1") ); Close(dt1, NoSave); For(i = 2, i <= N Items( fileList ), i++, dt = open(dirLoc || fileList[i] ); dt << Select Where( :Amount >= 500 ); y = dt << Subset ( Output Table Name("Temp")); x = x << Concatenate( y); Close(dt, NoSave); Close(y, NoSave); ); result = x<<Subset ( Output Table Name("Result"));

 

3 REPLIES 3
ErraticAttack
Level VI

Re: Save memory while Concatenating vertically in loop

You need to append the concatenated tables.  By default JMP concatenates tables into a new table.

 

names default to here(1);dirLoc=Pick Directory("Select a directory", "myDirectory\");
fileList = Files In Directory(dirLoc);
dt1 = open(dirLoc || fileList[1]);
dt1 << Select Where( :Amount >= 500 );
x=dt1 << Subset ( Output Table Name("T1") );
Close(dt1, NoSave);
For(i = 2, i <= N Items( fileList ), i++,
	dt = open(dirLoc || fileList[i] );
	dt << Select Where( :Amount >= 500 );
	y = dt << Subset ( Output Table Name("Temp"));
	x << Concatenate( y, "Append to First Table" );
	Close(dt, NoSave);
	Close(y, NoSave);
);
result = x<<Subset ( Output Table Name("Result"));

  

Jordan
monir
Level I

Re: Save memory while Concatenating vertically in loop

Thanks for your suggestion to append instead of concatenation. Actually I tried appending as well as shown below. The problem is, it pops up all the intermediate table every time it is appended in the loop.

 

x << Concatenate(x,y);

 Any thought?

ErraticAttack
Level VI

Re: Save memory while Concatenating vertically in loop

There might be some misunderstanding here.  Doing x << Concatenate( x, y ) will not update x, it will create a new table.

 

To update x with the values of y, use the literal expression x << Concatenate( y, "Append to First Table" )

 

Also, think about doing all this as private tables to conserve resources, then at the end show the table, like this:

 

Names Default To Here( 1 );
dirLoc = Pick Directory( "Select a directory", "myDirectory\" );
fileList = Files In Directory( dirLoc );
dt1 = Open( dirLoc || fileList[1], Private );
dt1 << Select Where( :Amount >= 500 );
x = dt1 << Subset( Output Table Name( "T1" ), Private );
Close( dt1, NoSave );

For( i = 2, i <= N Items( fileList ), i++,
	dt = Open( dirLoc || fileList[i], Private );
	dt << Select Where( :Amount >= 500 );
	y = dt << Subset( Output Table Name( "Temp" ), Private );
	x << Concatenate( y, "Append to First Table" );
	Close( dt, NoSave );
	Close( y, NoSave );
);

x << Set Name( "Result" );
x << New Data View;

 

Jordan