열에서 고유 값을 검색하고 입력 창에서 사용하려면 어떻게 해야 합니까?다음과 같은 표가 있습니다. "Cup Color" 열에서 고유한 값을 검색한 다음 사용자가 각 고유한 컵 색상에 해당하는 맛을 입력할 수 있는 팝업 창을 표시하고 싶습니다. .
| 컵 색상 | 칼로리 | 맛 | 순위 | 시험 장치 |
| 파란색 | 140 | 4 | 2 | 1 |
| 녹색 | 80 | 7 | 1 | 4 |
| 노란색 | 200 | 2 | 삼 | 6 |
| 보라 | 130 | 삼 | 6 | 4 |
| 파란색 | 140 | 삼 | 5 | 2 |
| 파란색 | 140 | 4 | 4 | 삼 |
| 노란색 | 200 | 5 | 7 | 1 |
각 컵 색상에 대한 맛이 있으면 사용자로부터 받은 입력을 기반으로 채워지는 새 열을 추가하고 싶습니다.
| 컵 색상 | 칼로리 | 맛 | 순위 | 시험 장치 | 맛 |
| 파란색 | 140 | 4 | 2 | 1 | 체리 |
| 녹색 | 80 | 7 | 1 | 4 | 산딸기 |
| 노란색 | 200 | 2 | 삼 | 6 | 초콜릿 |
| 보라 | 130 | 삼 | 6 | 4 | 정말 박하 |
| 파란색 | 140 | 삼 | 5 | 2 | 체리 |
| 파란색 | 140 | 4 | 4 | 삼 | 체리 |
| 노란색 | 200 | 5 | 7 | 1 | 초콜릿 |
나는 여전히 JSL에 익숙하지 않고 지난 몇 시간 동안 몇 가지 지침을 찾기 위해 포럼을 살펴보았지만 이를 함께 정리할 수 없는 것 같습니다. 약간의 도움을 주시면 감사하겠습니다.
Re: 열에서 고유한 값을 검색하여 입력창에 사용하려면 어떻게 해야 하나요?모달 창을 사용하는 것은 매우 독특한 유형의 창입니다.따라야 할 몇 가지 규칙이 있습니다.그 중 하나는 "OK"라는 텍스트가 있는 버튼 상자와 관련이 있습니다.모달 창에 특별한 기능이 있습니다.그래서 당신은 그것들을 사용할 수 있지만 그것들에 대해 공부하고 약간의 연습을 해야 할 것입니다.
내가 선호하는 것은 모달 창을 사용하는 것이 아니라 Functions() 또는 Expr() 요소를 사용하여 코드를 캡슐화하여 스크립트가 실행해야 한다고 표시할 때까지 실행되지 않도록 하는 것입니다.다음은 이를 수행하는 방법에 대한 간단한 예입니다.
Names Default To Here( 1 );
// Get the list of unique colors
Summarize( dt, colorList = by( :Cup Color ) );
// Initialize the flavor list and make it the same
// length as the colorList
flavorList = {};
For( i = 1, i <= N Items( colorList ), i++,
Insert Into( flavorList, "" )
);
// Create the display window
nw = New Window( "Select Flavors",
//<< Modal,
Text Box( "Enter in Flavors for each Color" ),
tb = Table Box(
String Col Box( "Colors", colorList ),
scb = String Col Edit Box( "Flavors", flavorList )
),
Button Box( "OK",
nw << close window;
// Create the flavor table and update it to
// the original table
dt2 = New Table( "combined",
New Column( "Cup Color", character, set values( colorList ) ),
New Column( "Flavors", character, set values( flavorList ) )
);
dt << Update( With( dt2 ), Match Columns( :Cup Color = :Cup Color ) );
close( dt2, nosave );
runAdditionalCodePlease;
)
);
// Set the String Col Edit Box action
scb << Set Function( Function( {this, which}, flavorList[which] = scb << get( which ) ) );
runAdditionalCodePlease = Expr(
Dialog("This represents the kind of things that",
"you may want to run after the data entry.",
"By placing the code inside an Expr() or in",
"a Function(). The code will be run only",
"when executed within the code."
)
);Re: 열에서 고유한 값을 검색하여 입력창에 사용하려면 어떻게 해야 하나요?실제로 진행하기 전에 사용자 입력을 기다리는 스크립트가 필요합니다.
모달 메시지를 사용하여 이 작업을 수행할 수 있는 스크립팅 가이드를 찾았고 올바르게 추가했다고 생각했지만 스크립트를 실행할 때 이제 테이블이 업데이트되지 않습니다. 로그에 "Name Unresolved: Button in access 또는 'Button' , Button( 1 ) /*###*/" 평가
// Get the list of unique colors
Summarize( dt, colorList = by( :Cup Color ) );
// Initialize the flavor list and make it the same
// length as the colorList
flavorList = {};
For( i = 1, i <= N Items( colorList ), i++,
Insert Into( flavorList, "" )
);
// Create the display window
nw = New Window( "Select Flavors",
<< Modal,
Text Box( "Enter in Flavors for each Color" ),
tb = Table Box(
String Col Box( "Colors", colorList ),
scb = String Col Edit Box( "Flavors", flavorList )
),
Button Box( "OK",
nw << close window;
// Create the flavor table and update it to
// the original table
dt2 = New Table( "combined",
New Column( "Cup Color", character, set values( colorList ) ),
New Column( "Flavors", character, set values( flavorList ) )
);
dt << Update( With( dt2 ), Match Columns( :Cup Color = :Cup Color ) );
close( dt2, nosave );
)
);
// Set the String Col Edit Box action
scb << Set Function( Function( {this, which}, flavorList[which] = scb << get( which ) ) );Re: 열에서 고유한 값을 검색하여 입력창에 사용하려면 어떻게 해야 하나요?완벽해, 고마워!Re: 열에서 고유한 값을 검색하여 입력창에 사용하려면 어떻게 해야 하나요?커뮤니티에 오신 것을 환영합니다.
먼저 JSL 학습 속도를 높이는 방법에 대한 제안이 있습니다.
스크립팅 가이드를 읽어보세요!!!!
그것은에서 사용할 수 있습니다
도움말==>도서==>스크립팅 가이드
다음은 요청한 작업을 수행하기 위한 베어본 스크립트입니다.
Names Default To Here( 1 );
dt = New Table( "Untitled 2",
Add Rows( 7 ),
New Column( "Cup Color",
Character,
"Nominal",
Set Selected,
Set Values( {"blue", "green", "yellow", "purple", "blue", "blue", "yellow"} )
),
New Column( "Calories",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [140, 80, 200, 130, 140, 140, 200] )
),
New Column( "Taste",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [4, 7, 2, 3, 3, 4, 5] )
),
New Column( "Ranking",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [2, 1, 3, 6, 5, 4, 7] )
),
New Column( "Tester",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [1, 4, 6, 4, 2, 3, 1] )
)
);
// Get the list of unique colors
Summarize( dt, colorList = by( :Cup Color ) );
// Initialize the flavor list and make it the same
// length as the colorList
flavorList = {};
For( i = 1, i <= N Items( colorList ), i++,
Insert Into( flavorList, "" )
);
// Create the display window
nw = New Window( "Select Flavors",
Text Box( "Enter in Flavors for each Color" ),
tb = Table Box(
String Col Box( "Colors", colorList ),
scb = String Col Edit Box( "Flavors", flavorList )
),
Button Box( "OK",
nw << close window;
// Create the flavor table and update it to
// the original table
dt2 = New Table( "combined",
New Column( "Cup Color", character, set values( colorList ) ),
New Column( "Flavors", character, set values( flavorList ) )
);
dt << Update( With( dt2 ), Match Columns( :Cup Color = :Cup Color ) );
close( dt2, nosave );
)
);
// Set the String Col Edit Box action
scb << Set Function( Function( {this, which}, flavorList[which] = scb << get( which ) ) );