Common Exceptions

Below you can find the most common exceptions that you can encounter in projects developed with UiPath. As a general note, all exceptions are types derived from System.Exception, so using this generic type in a Try Catch, for example, will catch all types of errors.

  • NullReferenceException - This error usually occurs when using a variable with no set value (not initialized).
  • IndexOutOfRangeException - Occurs when the index of an object is out of the limits of the collection. 
  • ArgumentException - Is thrown when a method is invoked and at least one of the passed arguments does not meet the parameter specification of the called method.
  • SelectorNotFoundException - Is thrown when the robot is unable to find the designated selector for an activity in the target app within the TimeOut period.
  • ImageOperationException - Occurs when an image is not found within the TimeOut period.
  • TextNotFoundException - Occurs when the indicated text is not found within the TimeOut period.
  • ApplicationException - describes an error rooted in a technical issue, such as an application that is not responding.

Business Rule Exceptions are separate from all the System Exceptions listed above. These describe errors rooted in the fact that certain data which the automation project depends on is incomplete, missing, outside of set boundaries (like trying to extract more from the ATM than the daily limit) or does not pass other data validation criteria (like an invoice amount containing letters).

The Business Rule Exceptions will not be thrown by using the generic System.Exception in a Try Catch activity. The mechanism of handling this exception has to be separately defined by the developer (based on the rules set by the process owner), or it can be reduced to stopping the execution of the process, by using a simple Throw activity, for example.

 

 

Try Catch Finally

 

 

ContinueOnError Property

 

Continue on Error is a property that specifies if the execution should continue even when the activity throws an error.

Keep in mind that, if the ContinueOnError is set to True on an activity that has a scope (such as Attach Window or Attach Browser), then all the errors that occur in other activities inside that scope are also ignored. 

Having this property set to true is not recommended in all situations, but there are some situations in which it makes sense, such as:

  • while using data scraping - so the activity doesn't throw an error on the last page (when the selector of the 'Next' button is no longer found);
  • when we are not interested in capturing the error, but simply in the execution of the activity.

 

 

 

StudioX에서는 file 을 scope로 읽어올 수 있어서 너무 편했었던거구나 하는 생각이 들었다

 

 

 

Assign values as getFileList = New List(of String)        리스트 초기화

Assign values as getFileList = Directory.GetFiles("경로")      불러올 폴더경로

 

하나의 확장자만 읽어와야하면 다음과 같이 정의하면 된다.

Assign values as getFileList = Directory.GetFiles("경로", "확장자(.docx 등...)")

 

 

PrintFiles.xaml
0.01MB

 

딱 순서만 바꾸면 해결될 수 있는 상황에 있다...

구글에 "uipath move column" 을 검색했는데, 정확한 용어는 "reorder column" 이었나보다..ㅎㅎ

 

* 참고 URL

- https://excelcult.com/2019/06/07/how-to-reorder-columns-in-datatable-in-uipath/

 

How To Reorder Columns In DataTable - In UiPath - ExcelCult

Sometimes we might be asked to change the order of the columns in the excel…

excelcult.com

- https://forum.uipath.com/t/how-to-reorder-columns-in-datatable/52945/5

 

How to reorder columns in datatable

What parameters do I need to set?

forum.uipath.com

- https://forum.uipath.com/t/how-to-change-the-datatable-column-sequence/2109

 

How to change the datatable column sequence

I read excel by using read excel and stored data in datatable, now i want to change the datatable column sequence. Please give solution.

forum.uipath.com

 

**** 정리

1. 이 방법은 컬럼 이름만 바꾸는 경우 같다... DT 내의 정보 이동은 불가한 것 같아 보인다...

Assign Value as DT.Columns(0).ColumnName = "New Column Name"
Assign Value as DT.Columns("바꾸기 이전 컬럼 네임").ColumnName = "New Column Name"

 

2. Invoke Method 사용.

- 이걸 사용하려면 컬럼네임을 알고 있어야한다.

TargetType null
TargetObject (메소드를 적용할 타겟 지정) DT.Columns("컬럼이름")
MethodName (사용할 메소드 이름)
SetOrdinal

Direction (데이터 방향) Type (value에 대한 타입) Value
In Int32 이동할 컬럼 값

 

invoke method 사용 예시)

1. 2번째 컬럼을 4번째로 옮기면?

첫번째 컬럼 두번째 컬럼 세번째 컬럼 네번째 컬럼 다섯번째 컬럼
0 1 2 3 4
번호 제목 담당부서 첨부 게시일
번호 담당부서 첨부 제목 게시일

 

2. 4번쩨 컬럼을 2번째로 옮기면?

첫번째 컬럼 두번째 컬럼 세번째 컬럼 네번째 컬럼 다섯번째 컬럼
0 1 2 3 4
번호 제목 담당부서 첨부 게시일
번호 첨부 제목 담당부서 게시일

 

 

보니까 컬럼의 이동이 맞다.. 서로 자리만 바꿔주는걸 찾아야하는데ㅠ

컬럼이 이동하면 한칸씩 뒤로 밀린다.

컬럼 하나가 이동하면 다른 컬럼이 뒤로나 앞으로 밀리는게 아니라, 서로의 자리를 바꿔주는 방법을 찾아보자..!

 

** SetOrdinal 의 정보 (출처 닷넷)

https://docs.microsoft.com/en-us/dotnet/api/system.data.datacolumn.setordinal?view=netframework-4.8

 

DataColumn.SetOrdinal(Int32) Method (System.Data)

 

Changes the ordinal or position of the to the specified ordinal o

docs.microsoft.com

 

Kill Process 정말 유용하다.

그런데 이런 식으로 강제종료하는 플로우는, 다시 똑같은 어플리케이션을 실행했을때 이전에 강제종료한 파일을 복구할거냐는 알림창이 뜨기 때문에 셀렉터 잡는데 시간이 더 오래걸릴수도 있다...

그래서 되도록이면 close 어플리케이션으로 끝내는게 좋다.

그리고 이런 Kill의 Process Name을 정리해주는 곳이 분명 어딘가에는 있을 것 같은데.. 찾기 어렵다 ㅠㅠ

 

 

 

1. Excel

 

2. Internet Explor

 

3. Chrome

 

 

 

 

하 정말 DataTable과 DataRow 요것들은 엄청 엄청 엄청 자주 사용하지만, 제대로 이해해두거나 공부해두지 않으면 잘 못쓰겠어서 이상한 편법만 늘어난다...  실제로 Studio에서 DataTable과 관련된 엄청나게 많은 Activity들이 있지만 나는 사용할줄 아는게 Build DataTable 밖에 없고..ㅋㅋㅋㅋ.... 하.... 그래서 이상한 VBA를 겁나 찾아서 떼었다가 붙였다가 하는데, 나의 사수들은 액티비티 써서 플로우를 스크롤 없이 깔끔하게 만들어버린다..

다들 RPA는 개발자 아니라고 개무시 하지만, 막상 이걸 해보면 말이 다들 달라질거다ㅠㅠ 플로우를 체계적으로 짜는 것과 남들이 한눈에 볼 수 있도록 쉽게 짜고 정리하는 것. 많은 액티비티를 능통하게 사용하고, 또 VB를 능숙하게 다룰 줄 안다면 진짜 리얼 베스트다...

 

** 간략한 그림설명 (내가 만듬 ㅎㅋㅎㅋ)

 

만약 이 DataTable이 REFramwork로 들어가서 Transaction Data가 된다면, 각 Row는 Transaction Item이 된다..!

 

** DataTable

- 3번의 데이터로우를 뽑고싶을때

 DT.Rows.item(3)

 

- 마지막 데이터로우를 찾고싶을때 (참고URL: https://forum.uipath.com/t/get-last-row-of-datatable/91391)

 

Get last row of DataTable

Hello everyone, I’m having a datatable like this: Column A Column B Column C marc male m Ellen female v Bart male m I want to get the last row of my datatable into a new datatable. So that my new datatable gives: Column A Column B Column C Bart male m How

forum.uipath.com

 // DT를 뒤집어서 첫번째 값 가져오기.
 // DT의 마지막 DataRow 한개만 찾고싶은 것 뿐인데, 굳이 DT로 다시 변환해야할 이유가 있을까.. 
 Assign value as newDT = DT.asenumerable.reverse().take(1).copytodatatable

 // copytodatatable을 사용하지 않으면 datarow 값으로 나온다.
 Assign value as newDR = DT.asenumerable.reverse().take(1)
 // 만약에 두개 이상의 assign을 만들지 않고 한번에 하고싶다면?
 // 나라면, DT의 Row 갯수-1의 아이템을 불러오는 방법으로 했을 것 같다.. 
 DT.Rows.Item(DT.Rows.Count-1)

 // 마지막 Row의 첫번째 컬럼값을 얻는다면 이렇게 하면 된다
 DT.Rows.Item(DT.Rows.Count-1)(0)

 

** DataRow

- 3번의 데이터로우에서 첫번째 컬럼 값을 뽑고 싶을때

 DT.Rows.item(3)(0)

 Assign value as DR = DT.Rows.item(0) ▶ DR.item(0)

 

 

 

 

딱 이틀 공부했던 것 같다..

사실 Academy 강의 양도 그렇고.. 반나절이면 다 들을 수 있고, 습득도 빠르게 할 수 있다.

 

나의 간략한 느낀점은...

1. 기존의 Studio에서 다수의 액티비티가 빠지고, 가벼운듯 보이지만 사실 개발 중인 프로그램이기 때문에 에러가 많다

2. 공부하는 사람이 적기 때문에 포럼에 글을 오려도 답을 받기 어렵다. 결국 에러를 어떻게 해결했냐면, 지인을 통해 RPA 본사의 StudioX 개발자에게 메일을 보내는 등 했다.

3. 확실히 Auto fill 같이 새로 보는 액티비티도 많았고, 엄청 유용해서 Studio에 가져가고 싶다는 생각이 들었다. 그래서 StudioX에서 작업한 파일을 Studio에서 열어보니까 수정과 실행이 가능했고, 거기서 사용했던 액티비티들도 패키지로 따라오기 떄문에 오 괜찮겠다 싶었다. 그런데 프로젝트를 새로 생성해서 StudioX의 패키지를 다운받으려고 찾아봤는데 아무리 검색해도 나오지 않았다. 아마 기존의 Studio와 StudioX 간의 차별성을 두기 위해서 패키지를 막아둔 것이 아닐까..?! 싶었다. 결론은, Studio에서 StudioX에서 작업한 파일을 불러오고 액티비티를 사용하여 수정도 할 수 있지만 액티비티를 자체적으로 가져오는 것이 어렵다.

4. Academy에서 StudioX는 처음 사용하는 사람들도 쉽게 사용할 수 있도록 만든 프로그램이라고 했는데... 도대체 이렇게 에러가 많고, 복잡해서 어떻게 배울 수 있을까 하는 생각이 들었지만 Studio와 찬찬히 비교해보면 뭐 그럴수도 있겠다는 생각이 들었다. 액티비티의 수와 동작할 수 있는 범위가 좁고, 한정적이다. 패키지를 다운받으면 그 부분은 해결될 것 같다. 주로 비니지스에서 이용되는 엑셀, 이메일, 파일 등을 주로 다룬다. 

 

아래는 내가 그냥 실습한 파일들... 에러가 있을수도 있다..ㅋ

 

AutomateFilesandFolders.zip
0.15MB
decisions-for-each.zip
0.10MB
DownlodaEmailReceipts.zip
0.25MB
EventOrganizer.zip
0.43MB
excelAutumation.zip
0.08MB
Hello_World.zip
0.05MB
ui-automation.zip
0.39MB

 

 

** 참고 URL : https://forum.uipath.com/c/dev/studiox

 

StudioX

Dedicated category for our new product UiPath StudioX.

forum.uipath.com

 

 

* 이번주 월요일 날짜 구하기 (오늘이 3월 18일 수요일이면, 3월 16일 월요일을 출력함.)

- 참고 주소 : https://forum.uipath.com/t/date-of-monday-in-the-current-week/27309/2

Assign the value as DateTime.Now.AddDays(-1*(7 + (DateTime.Now.DayOfWeek - DayOfWeek .Monday)) mod 7).Date.ToString

 

* 지난주 오늘 요일 날짜 구하기 (오늘이 3월 18일 수요일이면, 3월 11일 수요일을 출력함.)

- 참고 주소 : https://forum.uipath.com/t/get-date-from-last-week/179260

Assign the value as DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd")

 

* 지난주 화요일 날짜 구하기 (오늘이 3월 18일 수요일이면, 3월 10일 화요일을 출력함.)

- 참고 주소 : https://forum.uipath.com/t/date-of-monday-in-the-current-week/27309/5

Assign the value as DateTime.Now.AddDays(-7).AddDays(-1*(7 + (DateTime.Now.DayOfWeek - DayOfWeek.Tuesday)) mod 7).ToString("yyyy-MM-dd")
오늘 날짜 - 7 - 1*((7+(오늘요일-구하는요일))을 7로 나눈 나머지 값)

 

* 전월 1일 구하기 (오늘이 9월 17일이면, 8월 1일을 출력함.)

Assign the value as  New DateTime(DateTime.Now.Year, DateTime.Now.Month-1, 1)

 

* 전월 말일 구하기 (오늘이 9월 17일이면, 8월 31일을 출력함.)

Assign the value as  New DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddDays(-1)

 

+ Recent posts