列名を指定したユーザー定義関数 (JSL)入力の 1 つとして列名を指定できるユーザー定義関数を作成しようとしています。 たとえば、次のコードを使用して、指定された "ColumnName" が入力 "Value" と等しい行を選択する関数を作成したいとします。
TestFunction = Function( {TableName, ColumnName, Value}, {},
TableName << Select where(:ColumnName == Value);
);ただし、この関数を実行しようとすると、次のエラーが発生します。
Name Unresolved: ColumnName{1} in access or evaluation of 'ColumnName' , :ColumnName/*###*/私の何が間違っているのでしょうか?
Re: カラム名を指定したユーザー定義関数(JSL)ここに必要なことを実現するスクリプトがあります。最初の例ではデータ テーブルへのポインタを使用し、2 番目の例では実際のテーブル名を使用します。
names default to here(1);
dt=open("$SAMPLE_DATA/big class.jmp");
TestFunction = Function( {TableName, ColumnName, Value}, {},
TableName << Select where(as column(ColumnName) == Value);
);
testfunction(dt,"age",13);
names default to here(1);
dt=open("$SAMPLE_DATA/big class.jmp");
TestFunction = Function( {TableName, ColumnName, Value}, {},
data table(TableName) << Select where(as column(ColumnName) == Value);
);
testfunction("Big Class","age",13);