既存のデータから新しい列を作成する次の形式のセルを含むデータの列の1つを持つ大きなデータセットがあります。異なる「AppNames」を3つの別々の列に引き出す方法はありますか。ユーティリティで列へのテキスト機能を試しましたが、列内のすべてのセルに複数のアプリ名がリストされているわけではありません。…理想的には、「AppName:」文字列を「区切り文字」として使用できますか?したがって、以下の例から... 3つの新しい列で終わるはずです-Application1、Application2、およびApplication3を参照するデータで...ありがとう
フォーマット
tx:AppID:32734、tx: AppName:Application1 、tx:ServerEnv:Development、tx:ServerStatus:Deployed、tx:OwningVP:xxxxxxxxx、tx:DevMgr:xxxxxxxxx、tx:OwningDirector:xxxxxxxxx、tx:AppOwner:xxxxxxxxx、tx:BusinessOwner:xxxxxxxxx、tx:SOX:No、tx :PCI:No、tx:L5_MGR:xxxxxxxxx、tx:DataClass:Internal Use、tx:DRClass:Class I、tx:AppType:IT Supported、tx:OrgL2:TSO、tx:OrgL3:TMX、tx:OrgL4:MobileおよびVC、tx:AppID:655369、tx: AppName:Application2 、tx:OwningVP:xxxxxxxx、tx:DevMgr:xxxxxxxx、tx:OwningDirector:xxxxxxxx、tx:AppOwner:xxxxxxxx、tx:BusinessOwner:xxxxxxxxx、tx:SOX:KFS Tier 2、tx :: KBA Tier 1、tx:DataClass:制限付き、tx:OrgL2:CBS、tx:OrgL3:、tx:tx:AppID:655364、tx: AppName:Application3
再:既存の列のデータから新しい列を作成する私はあなたの問題に対して少し異なるアプローチを取りました。 データを見ると、行がアプリケーションである多くの異なる列があることに気づきました。 そのため、これらすべてを解決する小さなスクリプトを作成しました。 問題は、データにエラーがあることです。 そこで、それらを修正しようとするコード内の領域を追加しました。 すべてのデータを保持しているわけではありませんが、修正が必要になる可能性があります。 これらのデータを入力した後、データを3列に揃えたい場合は、データを3列に簡単に転置できます。
Names Default To Here( 1 );
theData =
"tx:AppID:32734, tx:AppName:Application1, tx:ServerEnv:Development, tx:ServerStatus:Deployed, tx:OwningVP:xxxxxxxxx, tx:DevMgr:xxxxxxxxx, tx:OwningDirector:xxxxxxxxx, tx:AppOwner:xxxxxxxxx, tx:BusinessOwner:xxxxxxxxx, tx:SOX:No, tx:PCI:No, tx:L5_MGR:xxxxxxxxx, tx:DataClass:Internal Use, tx:DRClass:Class I, tx:AppType:IT Supported, tx:OrgL2:TSO, tx:OrgL3:TMX, tx:OrgL4:Mobile and VC, tx:AppID:655369, tx:AppName:Application2, tx:OwningVP:xxxxxxxx, tx:DevMgr:xxxxxxxx, tx:OwningDirector:xxxxxxxx, tx:AppOwner:xxxxxxxx, tx:BusinessOwner:xxxxxxxxx, tx:SOX:KFS Tier 2, tx::KBA Tier 1, tx:DataClass:Restricted, tx:OrgL2:CBS, tx:OrgL3:, tx: tx:AppID:655364, tx:AppName:Application3";
dt = New Table( "The Table" );
dt << delete columns( "Column 1" );
word# = 1;
While( Word( word#, theData, "," ) != "",
colNameList = dt << get column names( string );
theWord = trim(Word( word#, theData, "," ));
// Make found corrections
If( Trim( Word( 2, theWord, ":" ) ) == "tx",
theword = Word( 2, theword, ":" ) || ":" || Word( 3, theWord, ":" ) || ":" || Word( 4, theWord, ":" )
);
If( word( 1, theWord, ":") == "", theWord = "tx" || theWord );
if( word( 2, theWord, ":") == "",
theword = Word( 1, theword, ":" ) || ":" || word(1,Word( 3, theWord, " " )," ") || ":" ||
substr(Word( 3, theWord, ":" ),length(Word( 3, theWord, ":" ))+2);
);
if( word( 3, theWord, ":") == "",
theword = Word( 1, theword, ":" ) || ":" || word(1,Word( 2, theWord, ":" )," ") || ":" ||
substr(Word( 2, theWord, ":" ),length(Word( 1, Word( 2, theWord, ":" ), " " ))+2);
);
if(word(2,theword,":")=="KBA",show(theword));
colName = Word( 2, theWord, ":" );
If( Word( 2, theWord, ":" ) == "AppID",
dt << Add Rows( 1 );
);
If( N Rows( Loc( colNameList, colName ) ) == 0,
dt << New Column( colName, character );
);
Column( dt, colName )[N Rows( dt )] = Word( 3, theWord, ":" );
word#++;
);
再:既存の列のデータから新しい列を作成するありがとうジム...私がやろうとしているのは、列「アセットタグ」から「AppName」データを引き出して、新しい列に入れることです(アプリケーション#1、#2、#3)。以下のスクリーンショットをご覧ください。
(AppName:Exchange 2013(350578)以下の行1の資産タグから)
列「Asset Tags」の行の一部には複数のAppNameが含まれていますが、残念ながら均一ではありません。以下の例を参照してください。
例1の形式 (1 AppName)
tx:AppID:350578、tx: AppName:Exchange 2013(350578)、 tx:ServerEnv:Production、tx:ServerStatus:In Maintenance、tx:OwningVP:xxxxxxxxx、tx:DevMgr:xxxxxxxxx、tx:OwningDirector:xxxxxxxxx、tx:AppOwner:xxxxxxxxx、tx:BusinessOwner:xxxxxxxxx、tx:SOX:No、tx :PCI:No、tx:L5_MGR:xxxxxxxxx、tx:EMEABanking:KBA Tier 2、tx:DataClass:Highly Restricted、tx:DRClass:Class I、tx:AppType:IT Supported、tx:OrgL2:TSO、tx:OrgL3: TMX、tx:OrgL4:メッセージングおよびコンテンツ管理
例2の形式 (3 AppNames)
tx:AppID:32734、tx: AppName:CITRIX(32734) 、tx:ServerEnv:Development、tx:ServerStatus:Deployed、tx:OwningVP:XXXXXXXXX、tx:DevMgr:XXXXXXXXX、tx:OwningDirector:XXXXXXXXX、tx:AppOwner:XXXXXXXXX、tx:BusinessOwner:XXXXXXXXX、tx:SOX:No、tx :PCI:No、tx:L5_MGR:XXXXXXXXX、tx:EMEABanking:KBA Tier 2、tx:DataClass:Internal Use、tx:DRClass:Class I、tx:AppType:IT Supported、tx:OrgL2:TSO、tx:OrgL3: TMX、tx:OrgL4:MobileおよびVC、tx:AppID:655369、tx: AppName:EBOSS EMEA(655369) 、tx:OwningVP:XXXXXXXXX、tx:DevMgr:XXXXXXXXX、tx:OwningDirector:XXXXXXXXX、tx:AppOwner:XXXXXXXXX、tx:BusinessOwner:XXXXXXXXX、tx:SOX:KFS Tier 2、tx:L5_MGR:XXXXXXXXX、tx:EMEABankingティア1、tx:DataClass:Restricted、tx:OrgL2:CBS、tx:OrgL3:Dell Financial SVCS、tx:OrgL4:DFS Originations and Lease Servicing、tx:AppID:655364、tx: AppName:TVALUE(655364)
例3の形式 (1 AppName、ただし異なる形式)
ext: AppName:電圧 、ext:PCI:N、ext:OrgL3:TMX、ext:L5_Mgr:xxxxxxxxx、ext:Owning_Director:xxxxxxxxx、ext:App_Owner:xxxxxxxxx、ext:Owning_Group:Messaging and Content Mgmt、Dell-External、External、High、Prohibited_Services、DCスキャン-外部、tx:AppID:2812、tx:AppName:Exchange 2010、tx:ServerEnv:Production、tx:ServerStatus:Deployed、tx:OwningVP:xxxxxxxxx、tx:DevMgr:xxxxxxxxx、tx:OwningDirector:xxxxxxxxx、tx: AppOwner:xxxxxxxxx、tx:BusinessOwner:xxxxxxxxx、tx:SOX:No、tx:PCI:No、tx:L5_MGR:xxxxxxxxx、tx:EMEABanking:No、tx:DataClass:Highly Restricted、tx:DRClass:Class I、tx: AppType:ITサポート、tx:OrgL2:TSO、tx:OrgL3:TMX、tx:OrgL4:MessagingおよびContent Mgmt
注:以下のアプリケーション#1列は、Col> Utilities ...のText-to-Column関数を使用して作成されました。
これをうまく説明しているかどうかわからない;-(

再:既存の列のデータから新しい列を作成する私はこのコードがあなたが望むことをするだろうと信じています。 添付のデータテーブルには、指定した例の3行が含まれています。 以下のスクリプトは、複数のアプリケーション抽出を処理します
Names Default To Here( 1 );
dt = Current Data Table();
dt << New Column( "Application #1", character );
dt << New Column( "Application #2", character );
dt << New Column( "Application #3", character );
For( theRow = 1, theRow <= N Rows( dt ), theRow++,
word# = 1;
appName# = 1;
While( Word( word#, :Asset Tags[theRow], "," ) != "",
theWord = Trim( Word( word#, :Asset Tags[theRow], "," ) );
If( Word( 2, theWord, ":" ) == "AppName",
Column( dt, "Application #" || Char( appName# ) )[theRow] = Word( 3, theWord, ":" );
appName#++;
);
word#++;
);
);
再:既存の列のデータから新しい列を作成する以下に、テーブルに値を追加することを含む、少し異なるアプローチを示します。 次のようなコードの上部に解析関数があります言葉 、ただし区切り文字は複数文字にすることができます。
//------------------------------------------------------------------------------
/*
Function Name: my_parse
Description: Parse text according to a given delimiter. Two delimiters in a row
will yield an empty list entry, which is different from the behavior
of WORDS
Returns: list of tokens
Arguments:
_text Text to determine be parsed
_delim Delimiter
*/
my_parse = function({_text, _delim},
{Default Local},
pname = "get_words";
if (is missing(_text),
// then
ret_list = {};
,
// else if
_text == "",
ret_list = {};
,
// else we've got some text to work with
ret_list = {};
len_delim = length(_delim);
istart = 1;
keep_going = 1;
while (keep_going,
iend = contains(_text, _delim, istart);
if (!iend,
keep_going = 0;
insertinto(ret_list, substr(_text, istart), 1);
,
insertinto(ret_list, substr(_text, istart, (iend - istart)), 1);
istart = iend + len_delim;
);
);
);
reverse(ret_list);
); // end my_parse
//------------------------------------------------------------------------------
dt = current data table();
dt << new column("Application #1", character);
dt << new column("Application #2", character);
dt << new column("Application #3", character);
for(i = 1, i <= nrows(dt), i++,
one_asset = dt:asset tags[i];
one_list = my_parse(one_asset, ", ");
app_list = {};
m = 0;
for (k = 1, k <= nitems(one_list), k++,
one_item = one_list[k];
aloc = contains(one_item, "AppName:");
if (aloc,
m++;
app_list[m] = substr(one_item, 8 + aloc);
);
);
show(app_list);
// Now add these to the respective Application # columns
for (k = 1, k <= nitems(app_list), k++,
cname = "Application #" || char(k);
column(dt, cname)[i] = app_list[k];
);
);