다시 : JSL을 사용하여 조건에 맞는 행을 선택하여 동적 행 수를 선택하십시오.나는 이런 식으로 시도하고 오류가 발생했습니다 '잘못된 인수'액세스 또는 평가에서 열을 {1}을 (를) 찾을 수 없습니다
내가 상상하는 것은 내 논쟁 고르다() 이내에 붙다() .
열 벡터를 변수에 할당하고 변수를 Select ()의 인수로 사용할 수 있다고 생각했습니다.
// Get a list of the column names
colList = TRANSPOSE << Get Column Names();
// Starting with column 3, select
For(i=3,i<= N Cols( TRANSPOSE ), i++, COLUMN( TRANSPOSE , colList[i]) << Set Selected(1) ) ;
// Assign those selected columns to a variable
Select_cols = TRANSPOSE << Get Selected Columns();
//then feed that variable into the Select() withing Join()
<SPAN class="token comment">// JOIN</SPAN>
DT <SPAN class="token operator">=</SPAN> <SPAN class="token function">Data Table</SPAN><SPAN class="token punctuation">(</SPAN> TRANSPOSE <SPAN class="token punctuation">)</SPAN> <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN><SPAN class="token messages"> Join</SPAN><SPAN class="token punctuation">(</SPAN>
With<SPAN class="token punctuation">(</SPAN> <SPAN class="token function">Data Table</SPAN><SPAN class="token punctuation">(</SPAN> CATEGORY_TABLE <SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN>
Select<SPAN class="token punctuation">(</SPAN> <SPAN class="token punctuation">:</SPAN>Forecast Material <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN>
SelectWith<SPAN class="token punctuation">(</SPAN> <SPAN class="token punctuation">:</SPAN>Category <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN>
Select<SPAN class="token punctuation">(</SPAN> Select_cols <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN> /// was Select<SPAN class="token punctuation">(</SPAN> <SPAN class="token punctuation">:</SPAN>Row <SPAN class="token number">1</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token punctuation">:</SPAN>Row <SPAN class="token number">2</SPAN> <SPAN class="token punctuation">)</SPAN>
By Matching Columns<SPAN class="token punctuation">(</SPAN> <SPAN class="token punctuation">:</SPAN>Label <SPAN class="token operator">=</SPAN> <SPAN class="token punctuation">:</SPAN>Category <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN>
Drop multiples<SPAN class="token punctuation">(</SPAN> <SPAN class="token number">0</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token number">0</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN>
Include Nonmatches<SPAN class="token punctuation">(</SPAN> <SPAN class="token number">0</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token number">0</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN>
Preserve main table order<SPAN class="token punctuation">(</SPAN> <SPAN class="token number">1</SPAN> <SPAN class="token punctuation">)</SPAN>
<SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
JSL을 사용하여 조건에 맞는 열을 선택하여 동적 열 수를 선택하십시오.https://www.jmp.com/support/help/14-2/use-set-selected-to-select-columns.shtml
이런 식으로 다시 쓰는 가장 좋은 방법은 무엇입니까?
DT는 TRANSPOSE 및 CATEGORY_TABLE의 조인입니다.
- CATEGORY_TABLE은 열 카테고리가있는 하나의 열 테이블입니다.
- TRANSPOSE는 데이터 전치의 결과입니다
트릭은 TRANSPOSE에 항상 같은 수의 열이있는 것은 아닙니다. 혼란스럽게도, 전치 함수의 출력은 추가 열의 이름을 행 1, 행 2 등으로 지정합니다.
- TRANSPOSE의 처음 두 열은 항상 같습니다.
- 열 1 행은 항상 3 번째 열로 존재합니다.
- 데이터 세트에 따라 열 2 행 이상이 존재할 수 있습니다.
Join ()이 적어도 행 1 열을 선택한 다음 마지막 열을 통해 더 많은 것이 있으면 Select () 함수를 작성할 수 있습니까?
// This section is only build to handle two columns named Row 1 and Row 2
DT = Data Table( TRANSPOSE ) << Join(
With( Data Table( CATEGORY_TABLE ) ),
Select( :Forecast Material ),
SelectWith( :Category ),
Select( :Row 1, :Row 2 ), // sometimes there is only one row, sometimes there are more than one rows ******How to handle this?********
By Matching Columns( :Label = :Category ),
Drop multiples( 0, 0 ),
Include Nonmatches( 0, 0 ),
Preserve main table order( 1 )
);
재 : JSL을 사용하여 조건에 맞는 행을 선택하여 동적 행 수를 선택하십시오."Select"가 포함 된 인수를 제거하십시오.
DT = Data Table( TRANSPOSE ) << Join(
With( Data Table( CATEGORY_TABLE ) ),
By Matching Columns( :Label = :Category ),
Drop multiples( 0, 0 ),
Include Nonmatches( 0, 0 ),
Preserve main table order( 1 )
);
결과에는 두 테이블의 모든 열이 포함됩니다.
재 : JSL을 사용하여 조건에 맞는 행을 선택하여 동적 행 수를 선택하십시오.고마워 돈. 다른 사람의 코드를 업데이트하려고합니다. 나는 이것이 우리가 원하는 것을하고 있다고 생각합니다. 솔루션으로 수락하기 전에 시간을내어 확인해야합니다. 내가 당신의 응답을 보지 못했다고 생각하지 않기를 바랐습니다. 어제이 제안으로 작업하고있었습니다. 감사!재 : JSL을 사용하여 조건에 맞는 행을 선택하여 동적 행 수를 선택하십시오.BSwid 감사합니다. 그것이 어떻게 작동하는지 알려주세요.