ユーザー定義関数: 出力変数の値を別の変数に渡す方法こんにちは。ユーザー入力を検証するコードを作成しています。ユーザー入力は 2 つのリスト B と C です。出力はリスト A で、リスト B と C の両方に含まれるすべての項目が含まれています。コードは次のとおりです。
//CHECK IF USER INPUT MAKES SENSE
Caption("Checking input data...");
col_name_list = dt << get column names( string );
//Check if there are duplicate or missing inputs
//Create a User-Defined Function
ColCheck=Function({main, second}, {duplicate},
(duplicate={}; Show (duplicate);
For (i=1, i<=Nitems(main), i++,
//Check if there are missing columns from user input
If ( !Contains( col_name_list, main[i] ),
Write("WARNING! Column " || main[i] ||" does not exists. Creating data column.");
Caption("WARNING! Column " || main[i] ||" does not exists. Creating data column.");
Wait( 1 );
script1 = "dt<<NEW column=""></NEW>Here is the output:
<CODE class=" language-jsl">A = {};
duplicate = {};
duplicate = {"two"};
duplicate = {"two", "three"};
A = .;The functions works, as seen from the values of "duplicate" variable. The problem is this: the duplicate content cannot be passed to variable "A". Is there anything wrong with my code?
Re: ユーザー定義関数: 出力変数の値を別の変数に渡す方法ありがとう、ジム。今は動いているよ。
最高、
シャイラ
Re: ユーザー定義関数: 出力変数の値を別の変数に渡す方法JMP 関数またはフォーマットから返されるのは最後に処理された値なので、最後の項目として「重複」を追加するとうまく機能します。
ColCheck = Function( {main, second},
{duplicate},
duplicate = {};
Show( duplicate );
For( i = 1, i <= N Items( main ), i++,
//Check if there are missing columns from user input
If( !Contains( col_name_list, main[i] ),
Write( "WARNING! Column " || main[i] || " does not exists. Creating data column." );
Caption( "WARNING! Column " || main[i] || " does not exists. Creating data column." );
Wait( 1 );
script1 = "dt<<NEW column=""></NEW>