データテーブルをフィルターして列の値を一括更新したい

以下処理の実装を考えているのですがどう作成したらいいかわからない状態です。
もし知識ある方いらっしゃいましたら教えていただきたいです。
宜しくお願い致します。

希望処理内容
①Noが重複
②状況が空欄、もしくは「待ち」
③重複データ内の「締切日」に1行でも値が入っている
上記3つの条件を満たしている場合は重複行全てに「結果」を未定と入力したいです。


@vgmadtg

Please check this

cheers

@Anil_G

thank you!

I would like some sample data using UiPath

@vgmadtg

sample data you have

and this can be directly used in assign

cheers

Could you please create a UiPath using this data, zip it and send it to me?
テスト.xlsx (8.9 KB)

こんにちは

以下いかがでしょうか?

dt.AsEnumerable.GroupBy(Function(r) r("No").ToString).Where(Function(g) g.Count>1 AndAlso g.All(Function(r) r("状況") IsNot Nothing AndAlso (String.IsNullOrEmpty(r("状況").ToString) OrElse r("状況").ToString="待ち")) AndAlso g.Count(Function(r) r("締切日") IsNot Nothing AndAlso  not String.IsNullOrEmpty(r("締切日").ToString))>0 ).SelectMany(Function(g) g).ToList.ForEach(Sub(r)
    r("結果")="未定"
End Sub
)

Sample20240610-1v2.zip (24.6 KB)

@Yoichi さん
いつも大変お世話になっております。
教えていただきありがとうございます。

無事反映されました。ありがとうございます!

ちなみに以下の条件も付け加えたいと思っているのですがこの処理って実装可能なのでしょうか…?
④重複内で「締切日」が全て埋まっていた場合は更新対象外とする

以下お試しください。

dt.AsEnumerable.GroupBy(Function(r) r("No").ToString).Where(Function(g) g.Count>1 AndAlso g.All(Function(r) r("状況") IsNot Nothing AndAlso (String.IsNullOrEmpty(r("状況").ToString) OrElse r("状況").ToString="待ち")) AndAlso not g.All(Function(r) r("締切日") IsNot Nothing AndAlso not String.IsNullOrEmpty(r("締切日").ToString  )) AndAlso g.Count(Function(r) r("締切日") IsNot Nothing AndAlso  not String.IsNullOrEmpty(r("締切日").ToString))>0 ).SelectMany(Function(g) g).ToList.ForEach(Sub(r)
    r("結果")="未定"
End Sub
)

Sample20240610-1v3.zip (25.3 KB)

@Yoichi さん
教えていただきありがとうございます!
正しく処理されるのが確認できました!
ありがとうございます!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.