UiPath 繰り返し(データテーブルの各行) For Each Rowについて

UiPath 繰り返し(データテーブルの各行) For Each Rowアクティビティとは?

UiPathの繰り返しアクティビティに関しては様々な記事がありますが、今回は初心者向けに繰り返し(データテーブルの各行)For Each Rowを少し分かりやすく話したいと思います。プログラミング言語・RPAUiPath・ローコード、どの言語やツールを使っても避けては通れない道です。かいつまんで説明します。

UiPathのワークフローを見てみよう。

For Each Row繰り返し(データテーブルの各行)アクティビティーはUiPathの繰り返しの中で最も使われるアクティビティーの一つと言えるでしょう。このアクティビティーには、まず前提として、データテーブルが存在することが前提になります。Excelファイルを呼び込みやデータテーブルを構築などで読み込んだDataTableを繰り返し繰り返し1行ずつ1行ずつ繰り返していてます。

 

今回は例として以下のようなエクセルファイルサンプルファイルが存在するとします。

このファイルを1度読み込み、耕一郎アクティビティーを使って、列氏名をそれぞれ書き込みしてみたいと思います。

 

フローチャートは以下の通りです。

アクティビティ「1行を書き込み」は以下の通りです。

CurrentRow(“氏名”).ToString

このようにSampleDtの列名「氏名」の一覧が出力されました。

解説 CurrentRowとは?

ここでもう少しかいつまんで説明してみたいと思います。この繰り返し(データテーブルの各行)の左上にある、CurrentRowとは一体何でしょうか?これは、繰り返し(データテーブルの各行)For Each Row アクティビティーが自動で出力する行型の変数になります。

このCurrentRowSampleDtの行として一つずつ処理をされることによって、ループ処理を繰り返していきます。

あまりイメージがつかないと思いますので、左側にUiPathのワークフロー、そして右側に実際に出力されているDataTableを可視化したものを並べるとわかりやすいかもしれないです。

UiPath 繰り返し(データテーブルの各行)For Each Row 解説

このようにエクセルで読み込んだDataTableをヘッダーと紐付いた状態で、各11行ずつ何回も何回も出力されていることが分かります。

繰り返し(データテーブルの各行)For Each Rowは0からカウントしていく。

一般的にものを数える時は1から順番に12345と増えていきます。しかし、プログラミングやとりわけFor Each RowDataTableに関しては0から12345とカウントされます。このことに気をつけてください。

取り出したい列名を選択する

次に出力したいデータテーブルの列名を指定します。指定の方法は二つあって、一つは数字によって出力する方法、もう一つは列名によって選択する方法です。
お好きな方法で列番号もしくは列名で指定してください。

よって、以下の1行を書き込みアクティビティには氏名の一覧が表示されるということです。

最後に

以上が繰り返し(データテーブルの各行)For Each Rowアクティビティーの説明になります。最初は0行目から始まるところにつまずくかもしれませんし、その後の列名の指定方法につまずくかもしれません。ここがExcelUiPathDataTableの一番異なるところです。一生懸命慣れていきましょう。

15件のフィードバック

  1. I do like the manner in which you have presented this specific issue plus it does indeed provide us some fodder for thought. Nevertheless, through just what I have observed, I simply just wish as the feedback pack on that men and women remain on point and in no way start upon a tirade of the news du jour. All the same, thank you for this superb point and though I can not necessarily agree with the idea in totality, I respect the viewpoint. Allan Helfen

  2. I really wanted to type a small word so as to express gratitude to you for all of the pleasant hints you are showing at this site. My rather long internet look up has now been compensated with reliable strategies to exchange with my pals. I would believe that most of us website visitors are truly lucky to live in a perfect community with so many wonderful people with great secrets. I feel pretty happy to have discovered your entire site and look forward to really more excellent moments reading here. Thanks a lot again for everything. Rob Bromfield

  3. Thank you for this details. You have actually written a very in-depth article regarding a subject that I really feel is really important. I intend to locate more information about this through your blog as well as strategy to share this article with others that I know. I am very pleased that I found your website. Malcom Dyll

  4. hey there and thank you for your information ? I have certainly picked up anything new from right here. I did however expertise some technical issues using this web site, as I experienced to reload the web site lots of times previous to I could get it to load properly. I had been wondering if your hosting is OK? Not that I am complaining, but sluggish loading instances times will sometimes affect your placement in google and could damage your high-quality score if advertising and marketing with Adwords. Well I am adding this RSS to my email and could look out for much more of your respective interesting content. Make sure you update this again soon.. Jarod Members

  5. What i do not realize is in reality how you’re now
    not really a lot more well-liked than you might be right now.
    You are so intelligent. You already know thus
    significantly in the case of this topic, made me personally imagine it from numerous
    various angles. Its like men and women aren’t involved unless it’s something to do
    with Woman gaga! Your personal stuffs nice.
    At all times deal with it up!

    Here is my blog post: vpn coupon 2024

  6. You actually make it seem really easy together with your presentation however I in finding this matter to be really one thing that I think I would by no means understand. It sort of feels too complicated and extremely huge for me. I am looking forward in your next put up, I will attempt to get the grasp of it! Rodger Igel

  7. I have to thank you for the efforts you’ve put in writing this blog.
    I’m hoping to check out the same high-grade content by you later
    on as well. In fact, your creative writing abilities
    has inspired me to get my own site now 😉

    my web site vpn special code

  8. Immediately, the write-up is in reality the sweetest on this laudable subject. I agree along with your conclusions and also definitely will eagerly look forward to your approaching updates. Merely just saying thanks certainly will not basically be enough, for the incredible lucidity in your writing. I surely will appropriate away grab your rss feed to stay privy of any kind of updates. Really great work and considerably success within your business efforts! Ashley Anick

  9. One more issue is that video games are generally serious naturally with the most important focus on knowing things rather than enjoyment. Although, there is an entertainment facet to keep the kids engaged, every single game will likely be designed to work on a specific skill set or curriculum, such as mathematics or scientific research. Thanks for your write-up. Bernardo Somji

  10. Thank you for your entire labor on this web site. Debby takes pleasure in getting into investigations and it is obvious why. I notice all relating to the compelling manner you deliver good tricks through your web blog and therefore foster participation from the others on this situation plus our favorite child is without question discovering a great deal. Enjoy the rest of the year. You are always performing a fabulous job. Zachariah Corre

  11. I was curious if you ever considered changing the page layout of your blog? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having 1 or two images. Maybe you could space it out better? Ernest Egvirre

  12. Thanks for the ideas you have discussed here. Additionally, I believe there are many factors that will keep your insurance premium straight down. One is, to take into account buying vehicles that are inside the good report on car insurance organizations. Cars that are expensive are more at risk of being lost. Aside from that insurance is also depending on the value of your truck, so the more expensive it is, then the higher the premium you have to pay. Burton Schoepf

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

目次