안녕 모두,
현재 사용자 입력을 기반으로 데이터 테이블에 열을 만드는 스크립트를 만들려고 합니다. 먼저 사용자에게 열 이름을 요청한 다음 사용자 입력에 따라 열의 이름을 다른 문자로 구문 분석합니다. 콤보 상자에서 선택한 옵션이 7개 미만인 경우 평가 가져오기에 문제가 있습니다. 현재 삭제된 상자는 '접착제'로 평가할 수 없다는 오류가 발생합니다. 이 문제를 해결할 방법이 있습니까? try 함수를 사용해 보았는데 이상한 값이 나왔습니다.
감사해요,
앤디
clearlog();
dt = Current Data Table();
nc = ncol(dt);
New Window("SID parser",
H List Box("Main Box",
V List Box("VLISTBOXcolumn names",
PanelBox("Select Column",
colListData=ColListBox(All,nLines(min(nc,10)))
), //end panel box
), // end VLISTBOXcolumn names
V List Box("VLISTBOXDIGITS",
Text Box("Select Number of Columns"),
x = Combo Box( {"1", "2","3","4","5","6","7"},
<< set function( Function( {this},
value = this << get;
If(
value == 1,
Try( (this << sib) << deletebox ); // delete what might already exist
this << sibappend(
V List Box(
H List Box(
Text Box("Number of Characters"),
y = Number Edit Box(2,4),
Text Box("Column Name"),
z = Text Edit Box("Protocol"),
z << set width(100),
) // end 1st column HLISTBOX
)
),
value == 2,
Try( (this << sib) << deletebox ); // delete what might already exist
this << sibappend( // add new box
V List Box(
H List Box(
Text Box("Number of Characters"),
y = Number Edit Box(2,4),
Text Box("Column Name"),
z = Text Edit Box("Protocol"),
z << set width(100),
), // end 1st column HLISTBOX
H List Box(
Text Box("Number of Characters"),
y2 = Number Edit Box(3,4),
Text Box("Column Name"),
z2 = Text Edit Box("Optional"),
z2 << set width(100),
) // end 2nd column h list box
) //end VLISTBOX
), // end sib append
value == 3,
Try( (this << sib) << deletebox ); // delete what might already exist
this << sibappend( // add new box
V List Box(
H List Box(
Text Box("Number of Characters"),
y = Number Edit Box(2,4),
Text Box("Column Name"),
z = Text Edit Box("Protocol"),
z << set width(100),
), // end 1st column HLISTBOX
H List Box(
Text Box("Number of Characters"),
y2 = Number Edit Box(3,4),
Text Box("Column Name"),
z2 = Text Edit Box("Optional"),
z2 << set width(100),
), // end 2nd column h list box
H List Box(
Text Box("Number of Characters"),
y3 = Number Edit Box(3,4),
Text Box("Column Name"),
z3 = Text Edit Box("Tube Type"),
z3 << set width(100),
), // end 3rd column h list box
) //end VLISTBOX
), // end sib append
value == 4,
Try( (this << sib) << deletebox ); // delete what might already exist
this << sibappend( // add new box
V List Box(
H List Box(
Text Box("Number of Characters"),
y = Number Edit Box(2,4),
Text Box("Column Name"),
z = Text Edit Box("Protocol"),
z << set width(100),
), // end 1st column HLISTBOX
H List Box(
Text Box("Number of Characters"),
y2 = Number Edit Box(3,4),
Text Box("Column Name"),
z2 = Text Edit Box("Optional"),
z2 << set width(100),
), // end 2nd column h list box
H List Box(
Text Box("Number of Characters"),
y3 = Number Edit Box(3,4),
Text Box("Column Name"),
z3 = Text Edit Box("Tube Type"),
z3 << set width(100),
), // end 3rd column h list box
H List Box(
Text Box("Number of Characters"),
y4 = Number Edit Box(3,4),
Text Box("Column Name"),
z4 = Text Edit Box("Sample Number"),
z4 << set width(100),
), // end 4th column h list box
), //end VLISTBOX
), // end sib append
value == 5,
Try( (this << sib) << deletebox ); // delete what might already exist
this << sibappend( // add new box
V List Box(
H List Box(
Text Box("Number of Characters"),
y = Number Edit Box(2,4),
Text Box("Column Name"),
z = Text Edit Box("Protocol"),
z << set width(100),
), // end 1st column HLISTBOX
H List Box(
Text Box("Number of Characters"),
y2 = Number Edit Box(1,4),
Text Box("Column Name"),
z2 = Text Edit Box("Optional"),
z2 << set width(100),
), // end 2nd column h list box
H List Box(
Text Box("Number of Characters"),
y3 = Number Edit Box(3,4),
Text Box("Column Name"),
z3 = Text Edit Box("Tube Type"),
z3 << set width(100),
), // end 3rd column h list box
H List Box(
Text Box("Number of Characters"),
y4 = Number Edit Box(3,4),
Text Box("Column Name"),
z4 = Text Edit Box("Sample Number"),
z4 << set width(100),
), // end 4th column h list box
H List Box(
Text Box("Number of Characters"),
y5 = Number Edit Box(1,4),
Text Box("Column Name"),
z5 = Text Edit Box("Analyte Level"),
z5 << set width(100),
), // end 5th column h list box
), //end VLISTBOX
), // end sib append
value == 6,
Try( (this << sib) << deletebox ); // delete what might already exist
this << sibappend( // add new box
V List Box(
H List Box(
Text Box("Number of Characters"),
y = Number Edit Box(2,4),
Text Box("Column Name"),
z = Text Edit Box("Protocol"),
z << set width(100),
), // end 1st column HLISTBOX
H List Box(
Text Box("Number of Characters"),
y2 = Number Edit Box(1,4),
Text Box("Column Name"),
z2 = Text Edit Box("Optional"),
z2 << set width(100),
), // end 2nd column h list box
H List Box(
Text Box("Number of Characters"),
y3 = Number Edit Box(3,4),
Text Box("Column Name"),
z3 = Text Edit Box("Tube Type"),
z3 << set width(100),
), // end 3rd column h list box
H List Box(
Text Box("Number of Characters"),
y4 = Number Edit Box(3,4),
Text Box("Column Name"),
z4 = Text Edit Box("Sample Number"),
z4 << set width(100),
), // end 4th column h list box
H List Box(
Text Box("Number of Characters"),
y5 = Number Edit Box(1,4),
Text Box("Column Name"),
z5 = Text Edit Box("Analyte Level"),
z5 << set width(100),
), // end 5th column h list box
H List Box(
Text Box("Number of Characters"),
y6 = Number Edit Box(1,4),
Text Box("Column Name"),
z6 = Text Edit Box("Run"),
z6 << set width(100),
), // end 6th column h list box
), //end VLISTBOX
), // end sib append
value == 7,
Try( (this << sib) << deletebox ); // delete what might already exist
this << sibappend( // add new box
V List Box(
H List Box(
Text Box("Number of Characters"),
y = Number Edit Box(2,4),
Text Box("Column Name"),
z = Text Edit Box("Protocol"),
z << set width(100),
), // end 1st column HLISTBOX
H List Box(
Text Box("Number of Characters"),
y2 = Number Edit Box(1,4),
Text Box("Column Name"),
z2 = Text Edit Box("Optional"),
z2 << set width(100),
), // end 2nd column h list box
H List Box(
Text Box("Number of Characters"),
y3 = Number Edit Box(3,4),
Text Box("Column Name"),
z3 = Text Edit Box("Tube Type"),
z3 << set width(100),
), // end 3rd column h list box
H List Box(
Text Box("Number of Characters"),
y4 = Number Edit Box(3,4),
Text Box("Column Name"),
z4 = Text Edit Box("Sample Number"),
z4 << set width(100),
), // end 4th column h list box
H List Box(
Text Box("Number of Characters"),
y5 = Number Edit Box(1,4),
Text Box("Column Name"),
z5 = Text Edit Box("Analyte Level"),
z5 << set width(100),
), // end 5th column h list box
H List Box(
Text Box("Number of Characters"),
y6 = Number Edit Box(1,4),
Text Box("Column Name"),
z6 = Text Edit Box("Run"),
z6 << set width(100),
), // end 6th column h list box
H List Box(
Text Box("Number of Characters"),
y7 = Number Edit Box(1,4),
Text Box("Column Name"),
z7 = Text Edit Box("extra"),
z7 << set width(100),
), // end 7th column h list box
), //end VLISTBOX
); // end sib append
); // end if statement
)) //end function
), //end combo box
V List Box(
H List Box(
Text Box("Number of Characters"),
y = Number Edit Box(2,4),
Text Box("Column Name"),
z = Text Edit Box("Protocol"),
z << set width(100),
) // end 1st column HLISTBOX
); // since 1 is selected by default, put the box here initially
), //end VLISTBOXDIGITS
), // end HLISTBOX Main Box
H List Box("OK and Cancel",
Button Box("OK",
Print( "Pressed OK");
SelectedColumn = colListData << getSelected;
firstdigit = y << get();
seconddigit = y2 << get();
thirddigit = y3 << get();
fourthdigit = y4 << get();
fifthdigit = y5 << get();
sixthdigit = y6 << get();
seventhdigit = y7 << get();
firstColumnName = z << getText();
secondColumnName = z2 << getText();
thirdColumnName = z3 << getText();
fourthColumnName = z4 << getText();
fifthColumnName = z5 << getText();
sixthColumnName = z6 << getText();
seventhColumnName = z7 << getText();
currentwindow() << closewindow()
), // end Button Box OK
Button Box("Cancel", currentwindow() << closewindow())
), // end Button Box Cancel
); //end SID parser dialog box
try( dt << Delete Column( ascolumn(firstColumnName)) );
dt << new column(firstColumnName, character, nominal,
Formula(substr(ascolumn(SelectedColumn),0,firstdigit),empty())
);
try( dt << Delete Column( ascolumn(secondColumnName)) );
dt << new column(secondColumnName, character, nominal,
Formula(substr(ascolumn(SelectedColumn),Add(firstdigit,1),seconddigit),empty())
);
try( dt << Delete Column( ascolumn(thirdColumnName)) );
dt << new column(thirdColumnName, character, nominal,
Formula(substr(ascolumn(SelectedColumn),Add(firstdigit,seconddigit,1),thirddigit),empty())
);
try( dt << Delete Column( ascolumn(fourthColumnName)) );
dt << new column(fourthColumnName, character, nominal,
Formula(substr(ascolumn(SelectedColumn),Add(firstdigit,seconddigit,thirddigit,1),fourthdigit),empty())
);
try( dt << Delete Column( ascolumn(fifthColumnName)) );
dt << new column(fifthColumnName, character, nominal,
Formula(substr(ascolumn(SelectedColumn),Add(firstdigit,seconddigit,thirddigit,fourthdigit,1),fifthdigit),empty())
);
try( dt << Delete Column( ascolumn(sixthColumnName)) );
dt << new column(sixthColumnName, character, nominal,
Formula(substr(ascolumn(SelectedColumn),Add(firstdigit,seconddigit,thirddigit,fourthdigit,fifthdigit,1),sixthdigit),empty())
);
try( dt << Delete Column( ascolumn(seventhColumnName)) );
dt << new column(seventhColumnName, character, nominal,
Formula(substr(ascolumn(SelectedColumn),Add(firstdigit,seconddigit,thirddigit,fourthdigit,fifthdigit,sixthdigit,1),seventhdigit),empty())