TimeSpan変数の値を("hh\:mm\:ss")のフォーマットでセルに書き込みたい

こんばんは。
UiPath Studio 2024.10.4Community editionのユーザです。

Add DataRowアクティビティの列配列において、下記の構文で複数のTimeSpan変数の平均値を計算しています。
New Object(){kv.Key,TimeSpan.FromSeconds(Math.Round(arr_DataRow.Average(Function(r) TimeSpan.Parse(r("TimeSpan").ToString).TotalSeconds),0,MidpointRounding.AwayFromZero)).ToString}

計算結果をセルに書き込む際に

TimeSpan.Parse(Row("AVG TimeSpan").ToString())

の構文だと、1分20秒が、"01:20.0"と表示されてしまいます。(添付画像参照)
集計表

そこで、

TimeSpan.Parse(Row("AVG TimeSpan").ToString("hh\:mm\:ss"))

と直そうとしたのですが、UiPathがこの構文を受け付けません。

構文をどう修正すれば、"01:20.0"を"00:01:20"とExcelのセルに出力できますか?

@gorby

I believe this is what you need to do

New Object(){kv.Key,TimeSpan.FromSeconds(Math.Round(arr_DataRow.Average(Function(r) TimeSpan.Parse(r("TimeSpan").ToString).TotalSeconds),0,MidpointRounding.AwayFromZero)).ToString("hh:mm:ss")}

cheers

Hi @Anil_G
Thank you for your advice!
However, the situation did not change at all after apllying your advice…(See the attached png file)

Adding this, small change was needed.
ToString(“hh:mm:ss”) ⇒ ToString(“hh\:mm\:ss”)

Hope your improved suggestion!!

@gorby

Can you tell if you are reading and then writing the data?

As per what I see it is using a different format all together and that happens if you use timespan.parse again

is there some step happening like that again?

cheers

Since I uploaded the excel sheet, pls check by yourself. I could not find any symptom of error.

Data Source: average of blue cell of “Sheet2” ⇒ Result:blue cell of “Sheet1”
Data Source: average of yellow cell of “Sheet2” ⇒ Result:yellow cell of “Sheet1”
OUTPUT.xlsx (33.5 KB)