๐Ÿฃ LINQ๋กœ RPA datatable์„ ์ฟผ๋ฆฌ๋กœ ํ•„ํ„ฐ๋ง Basic

LINQ๋กœ data๋ฅผ ๋น ๋ฅด๊ฒŒ ํ•„ํ„ฐ๋งํ•˜์ž

Posted by labft3231 on April 1, 2020

UiPath LINQ Basic

LINQ๋Š” Language Integrate Query์˜ ์•ฝ์ž๋กœ ์ฟผ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•ด ๋ฐ์ดํ„ฐ๋ฅผ ์‰ฝ๊ฒŒ ํ•„ํ„ฐ๋ง ํ• ์ˆ˜์žˆ๋„๋ก ๋„์™€์ค๋‹ˆ๋‹ค. ํ•ด๋‹น ํ”„๋กœ์ ํŠธ๋Š” ์กฐ๊ฑด๊ฐ’์— ๋”ฐ๋ผ ํ•„ํ„ฐ๋ง ํ•˜๋Š”๊ฒƒ์— ๋Œ€ํ•œ 3๊ฐ€์ง€ ์˜ˆ์ œ๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

https://github.com/labft3231/LINQ_Basic ๐Ÿ‘ˆ LINQ ํ”„๋กœ์ ํŠธ ๋งํฌ

LINQ๋ฅผ ํ†ตํ•ด์„œ ํ•„์š”ํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ๋น ๋ฅด๊ฒŒ ๊ฒ€์ถœํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ UiPath Certification ์—์„œ๋„ LINQ ์‚ฌ์šฉ์„ ๊ถŒ์žฅํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

Main.xaml

  • main์—์„œ๋Š” ๊ฐ„๋‹จํ•œ Datatable์„ ๋งŒ๋“ค๊ณ  ์ด๋ฅผ ํ…Œ์ด๋ธ”๋ช….Select(โ€œ์ปฌ๋Ÿผ๋ช… >3โ€) ์„ ํ†ต์˜ํ•˜์—ฌ ๋ฐ์ดํ„ฐ๋ฅผ ํ•„ํ„ฐ๋งํ•˜์—ฌ ์ถœ๋ ฅํ•œ๋‹ค.

ExcelToLINQ.xaml

  • ExcelToLINQ์—์„œ๋Š” (From r In ํ…Œ์ด๋ธ”๋ช… Where cint(r(โ€œ์ปฌ๋Ÿผ๋ช…โ€)) > 300).CopyToDataTable ์„ ํ†ตํ•ด์„œ ๋ฐ์ดํ„ฐ๋ฅผ ํ•„ํ„ฐ๋งํ•œ๋‹ค.

CollectionLINQ.xaml

  • CollectionLINQ์—์„œ๋Š” From name In Collection๋ช… Where name.StartsWith(โ€œAโ€) Select name ๋ช…๋ น์–ด๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ํ•„ํ„ฐ๋งํ•œ๋‹ค. (์ฐธ๊ณ  : https://github.com/ufonlo/UIPath/blob/master/Library/Samples/Advanced/Filter%20Collection%20using%20LINQ.xaml)