기존 데이터의 데이터에서 새 열 만들기아래 형식의 셀을 포함하는 데이터 열 중 하나에 큰 데이터 세트가 있습니다. 다른 'AppNames'를 세 개의 개별 열로 가져 오는 방법이 있습니까? 유틸리티에서 Text to Columns 기능을 시도했지만 열의 모든 셀에 둘 이상의 appname이 나열되어 있지 않거나 약간 다른 정보가 포함되어 있으며 정렬이 취소되어 새 열에서 잘못된 값을 얻습니다. … 'AppName :'문자열을 '구분자'로 사용할 수 있습니까? 아래 예에서 ... 응용 프로그램 1, 응용 프로그램 2 및 응용 프로그램 3을 참조하는 데이터와 함께 세 개의 새로운 열로 끝나야합니다. 감사합니다.
체재
tx : AppID : 32734, tx : AppName : 응용 프로그램 1 , tx : ServerEnv : 개발, tx : ServerStatus : 배포, tx : 소유 VP : 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 : 내부 사용, tx : DRClass : Class I, tx : AppType : IT 지원, tx : OrgL2 : TSO, tx : OrgL3 : TMX, tx : OrgL4 : Mobile 및 VC, tx : AppID : 655369, tx : AppName : 응용 프로그램 2 , 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 : 응용 프로그램 3
재 : 기존 데이터의 데이터에서 새 열 만들기나는 당신의 문제에 대해 조금 다른 접근법을 취했습니다. 귀하의 데이터를 살펴보면, 귀하가 가지고있는 것이 많은 다른 열이며 행이 응용 프로그램이라는 것을 깨달았습니다. 그래서 나는이 모든 것을 깨는 작은 스크립트를 작성했습니다. 이제 문제는 데이터에 오류가 있다는 것입니다. 그래서 코드를 수정하려고하는 영역을 코드에 추가했습니다. 모든 데이터를 가지고 있지는 않지만 더 많은 수정이 필요할 수 있습니다. 이러한 데이터가 입력 된 후에도 데이터를 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#++;
);
재 : 기존 데이터의 데이터에서 새 열 만들기Jim 감사합니다 ... 내가하려는 것은 '자산 태그'열에서 'AppName'데이터를 가져 와서 새로운 열로 가져 오는 것입니다 (응용 프로그램 # 1, # 2, # 3). 아래 스크린 샷을 참조하십시오.
(AppName : Exchange 2013 (350578) 아래 행 1의 자산 태그)
'자산 태그'열의 일부 행에 둘 이상의 AppName이 포함되어 있으며 불행하게도 균일하지 않습니다 (아래 예 참조).
예 1 형식 (1 AppName)
tx : AppID : 350578, tx : AppName : Exchange 2013 (350578), tx : ServerEnv : Production, tx : ServerStatus : 유지 관리, 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 : 개발, tx : ServerStatus : 배포, tx : 소유 VP : XXXXXXXXX, tx : DevMgr : XXXXXXXXX, tx : OwningDirector : XXXXXXXXX, tx : AppOwner : XXXXXXXXX, tx : BusinessOwner : XXXXXXXXX, tx : SOX : No, tx : PCI : 아니오, tx : L5_MGR : XXXXXXXXX, tx : EMEA 뱅킹 : KBA Tier 2, tx : DataClass : 내부 사용, tx : DRClass : Class I, tx : AppType : IT 지원됨, tx : OrgL2 : TSO, tx : OrgL3 : TMX, tx : OrgL4 : 모바일 및 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 : EMEA 뱅킹 Tier 1, tx : DataClass : Restricted, tx : OrgL2 : CBS, tx : OrgL3 : Dell Financial SVCS, tx : OrgL4 : DFS 발신 및 임대 서비스, tx : AppID : 655364, tx : AppName : TVALUE (655364)
예 3 형식 (1 AppName이지만 다른 형식)
내선 : AppName : 전압 , ext : PCI : N, ext : OrgL3 : TMX, ext : L5_Mgr : xxxxxxxxx, ext : Owning_Director : xxxxxxxxx, ext : App_Owner : xxxxxxxxx, ext : Owning_Group : 메시징 및 컨텐츠 관리, Dell- 외부, 외부, 높음, 금지 된 서비스, 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 : 메시징 및 컨텐츠 관리
참고 : 아래 응용 프로그램 # 1 열은 Col> 유틸리티 ...에서 텍스트-컬럼 기능을 사용하여 작성되었습니다.
이것을 잘 설명하고 있는지 확실하지 않습니다 ;-(

재 : 기존 데이터의 데이터에서 새 열 만들기이 코드가 원하는 것을 할 것이라고 믿습니다. 제공 한 예제의 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];
);
);