UiPath循环活动For Each的介绍和使用
一、For Each的介绍
For Each:循环迭代一个列表、数组、或其他类型的集合, 可以遍历并分别处理每条信息
二、For Each在UiPath中的使用
1. 打开设计器,在设计库中新建一个Flowchart
![](https://upload-images.jianshu.io/upload_images/14843435-6e9e1b723d36b1e4.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
2. 为Flowchart命名并设置存储路径
![](https://upload-images.jianshu.io/upload_images/14843435-93c0913b86f0de6e.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
3.在Activities中搜索Assign,并将Assign控件拖至设计区
![](https://upload-images.jianshu.io/upload_images/14843435-9a285d9a0ad1242f.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
4.在Assign中设置变量,及为集合写入数据
注:Assign格式选择ArrayOf[T]--String,集合格式为{“”,””}
![](https://upload-images.jianshu.io/upload_images/14843435-fb4422433820b542.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
5.在Activities中搜索For Each,并将For Each控件拖至设计区
![](https://upload-images.jianshu.io/upload_images/14843435-ad794cf8545c3597.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
6.在For Each控件里填写传入变量值,并添加Log Message控件用来打印List
![](https://upload-images.jianshu.io/upload_images/14843435-255ec54086f0bfb7.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
7. 点击Run执行,点击Output查看执行结果
![](https://upload-images.jianshu.io/upload_images/14843435-a4010c3d3942037d.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
UiPath交流群:465630324