검색어 스크립트모달 창으로 시작하고 몇 가지 저장 프로 시저를 실행하고 결과 테이블을 자동으로 조인하는 스크립트를 만듭니다. 이것들은 상당히 큰 테이블이며 사용자가 쿼리 작성기와 비슷한 것을 실행하는 옵션을 추가하여 열을 필터로 선택하고 필터링 할 데이터를 입력 할 수 있습니다.
테이블을 열기 전에 어떻게해야합니까? 프로 시저를 실행하고 테이블을 조인하는 데 걸리는 시간을 최소화하고 싶기 때문에 최종 테이블을 연 후 데이터를 필터링하는 것은 실제로 원하는 작업이 아닙니다.
어떤 제안이라도 대단히 감사하겠습니다!
다시 : 쿼리 스크립트이것에 대한 일반적인 해결책은 꽤 복잡 할 것입니다. 만들 수있는 고정 된 수의 대화 상자를 만들 수 있습니다.
// Get numeric column names from sample data
dt = open("$sample_data\Boston Housing.jmp");
col_list = dt << get column names("String", numeric);
insertinto(col_list, "<NO selection="">", 1);
nw = new window("Get Data2",
panel box("Filter Data",
lineup box(ncol(3),
text box("Column"), text box("Low Value"), text box("High Value"),
cb1 = combo box(col_list),
low1 = number edit box(),
high1 = number edit box(),
cb2 = combo box(col_list),
low2 = number edit box(),
high2 = number edit box(),
cb3 = combo box(col_list),
low3 = number edit box(),
high3 = number edit box(),
// Add more columns if needed...
)
)
);</NO>

다시 : 쿼리 스크립트저장 프로 시저를 실행하고 열 및 데이터 형식의 전체 목록을 얻은 다음 그 중 일부를 옵션으로 사용하면 필터를 만들 수 있습니까? 그것은 약 45 칼럼으로 끝납니다. 그래서 더 좋은 것이 있다면 알려주세요!
다시 : 쿼리 스크립트사용자가 필터를 선택하게하려면 어떻게해야합니까? 마치 데이터 테이블을 열고 싶지만 길이가 20-40이고 Scale이 25 나노 미터 인 곳만 원했습니다. 그러나 사용자가 사용 가능한 열에서 적용 할 필터를 선택할 수 있기를 바랍니다.
다시 : 쿼리 스크립트모달 창에 프롬프트를 추가하여 데이터를 사전 필터링 할 수 있습니다. 다음은 쿼리를 실행하기 전에 사용자가 제품과 위치를 미리 선택할 수있는 간단한 예제입니다. 선택할 값 목록을 하드 코드했습니다. 그러나 SQL 쿼리를 사용하여 동적으로 가져 오는 것이 이상적입니다.
// Hardcode or get dynamically from the database
product_list = {"AAAA", "BBBB", "CCCC", "DDDD"};
// Hardcode or get dynamically from the database
location_list = {"China", "England", "Germany", "Italy", "Japan", "USA"};
nw = new window("Get Data", << modal,
panel box("Pre-Filter",
hlistbox(
product_cb = listbox(product_list),
location_cb = listbox(location_list)
),
),
panel box("Actions",
hlistbox(
button box("OK",
ok_pushed = 1;
selected_products = product_cb << get selected;
selected_locations = location_cb << get selected
),
button box("Cancel",
ok_pushed = 0;
)
)
)
);
if (ok_pushed,
product_in_list = "";
location_in_list = "";
print(selected_products, selected_locations);
if (nitems(selected_products) > 0,
product_in_list = "t.products IN ('" ||
concat items(selected_products, "', '") || "')";
);
if (nitems(selected_locations) > 0,
location_in_list = "t.locations IN ('" ||
concat items(selected_locations, "', '") || "')";
);
print(product_in_list, location_in_list);
// run SQL query
);

로그 출력 :
{"AAAA", "CCCC"}
{"England", "Germany", "Italy"}
"t.products IN ('AAAA', 'CCCC')"
"t.locations IN ('England', 'Germany', 'Italy')"