創建列的問題大家好
我遇到了一個非常簡單的問題,那就是創建列。
當我單獨運行以下代碼時,日誌中會出現此錯誤
Try(dt_firstseq_summary << Delete Column( "Percent" ) );
dt_firstseq_summary << New Column( "Percent",
Numeric,
Continuous,
Format( "Best", 8 ),
Formula( :Name("Total_Tested") / Col Sum(:Total_Tested) )
);
dt_firstseq_summary :name( "Percent" ) << Delete formula;錯誤:
發送在訪問或評估“發送”時需要可編寫腳本的對象,dt_firstseq_summary << /*###*/New Column("Percent",
數字,
連續的,
格式(“最佳”,8),
公式(:Total_Tested / Col Sum(:Total_Tested))
) /*###*/
在以下腳本中,錯誤標記為 /*###*/
嘗試(dt_firstseq_summary <<刪除列(“百分比”));
dt_firstseq_summary << /*###*/新列(“百分比”,
數字,
連續的,
格式(“最佳”,8),
公式(:Total_Tested / Col Sum(:Total_Tested))
) /*###*/;
dt_firstseq_summary:Percent << 刪除公式;
但是當我運行整個程序時,它可以在數據表中創建列,但是百分比列無法計算值。見下圖:

錯誤:
列百分比公式中斷
名稱未解析:Total_Tested 1 次在行:2 操作:Total_Tested, :Total_Tested/*###*/
公式評估錯誤已被忽略
我可以知道如何解決嗎?
任何答案都值得讚賞。
謝謝。
Re: 創建列的問題保存從聯接操作返回的數據表引用。 然後使用它發送消息以創建您想要的新列。 像這樣:
dt_joined = dt_firstseq_summary << Join(
With(dt_final_summary),
Select( :S_B_Name, :N Rows, :Name( "Percent" ) ),
SelectWith( :S_B_Name, :N Rows, :Name( "Percent" ) ),
By Matching Columns( :S_B_Name = :S_B_Name ),
Preserve Main Table Order();
Output Table Name("Combined Table");
);
dt_joined << New Column( ... :(</img>Re: 創建列的問題大家好
我現在可以將 2 個數據表合併為一個數據表。(組合數據表)
但現在我的問題是如何在組合數據表中創建另一個新列?
這是我將 2 個數據表連接在一起的連接腳本:
dt_firstseq_summary << Join(
With(dt_final_summary),
Select( :S_B_Name, :N Rows, :Name( "Percent" ) ),
SelectWith( :S_B_Name, :N Rows, :Name( "Percent" ) ),
By Matching Columns( :S_B_Name = :S_B_Name ),
Preserve Main Table Order();
Output Table Name("Combined Table");
);謝謝。
Re: 創建列的問題嗨,吉姆
是的,匯總表將與原始數據錶鍊接。
我會再試一次。
感謝幫助。
Re: 創建列的問題您的匯總表是否可能仍鏈接到原始數據表,這是否會導致您的問題?
我用您的數據表的模擬版本嘗試了您的代碼,並且代碼沒有問題。