|
9 | 9 | x:Class="DataEntry"
|
10 | 10 | DisplayName="Data Entry">
|
11 | 11 | <x:Members>
|
12 |
| - <x:Property Name="extractedData" Type="InArgument(x:Array(x:String))" /> |
| 12 | + <x:Property Name="extractedData" Type="InArgument(System.Data.DataTable)" /> |
| 13 | + <x:Property Name="webAppUrl" Type="InArgument(x:String)" /> |
13 | 14 | </x:Members>
|
14 | 15 | <Sequence DisplayName="Data Entry Sequence">
|
15 |
| - <OpenBrowser DisplayName="Open Browser" Url="http://your-web-application-url.com" BrowserType="Chrome"> |
16 |
| - <Do> |
| 16 | + <TryCatch DisplayName="Try-Catch for Error Handling"> |
| 17 | + <Try DisplayName="Enter Data"> |
| 18 | + <Sequence DisplayName="Data Entry Logic"> |
| 19 | + <OpenBrowser DisplayName="Open Browser" Url="[webAppUrl]" BrowserType="Chrome"> |
| 20 | + <Do> |
| 21 | + <ForEach x:TypeArguments="System.Data.DataRow" DisplayName="For Each Row" Values="[extractedData.Rows]"> |
| 22 | + <ActivityAction x:TypeArguments="System.Data.DataRow"> |
| 23 | + <Sequence DisplayName="Process Row"> |
| 24 | + <Assign DisplayName="Assign Current Row" To="[currentRow]" Value="[item]" /> |
| 25 | + |
| 26 | + <!-- Validate Data --> |
| 27 | + <If DisplayName="Validate Data"> |
| 28 | + <If.Condition> |
| 29 | + <InArgument x:TypeArguments="s:Boolean">[Not String.IsNullOrEmpty(currentRow("Name").ToString) AndAlso Not String.IsNullOrEmpty(currentRow("Email").ToString)]</InArgument> |
| 30 | + </If.Condition> |
| 31 | + <Then> |
| 32 | + <Sequence> |
| 33 | + <!-- Enter Data into Web Application --> |
| 34 | + <TypeInto DisplayName="Type Name" Text="[currentRow("Name").ToString]" Selector="<your_selector_for_name>" /> |
| 35 | + <TypeInto DisplayName="Type Email" Text="[currentRow("Email").ToString]" Selector="<your_selector_for_email>" /> |
| 36 | + <Click DisplayName="Submit" Selector="<your_selector_for_submit_button>" /> |
| 37 | + </Sequence> |
| 38 | + </Then> |
| 39 | + <Else> |
| 40 | + <Sequence> |
| 41 | + <WriteLine DisplayName="Log Validation Error" Text="Validation failed for row: [currentRow("Name").ToString], [currentRow("Email").ToString]" /> |
| 42 | + <MessageBox DisplayName="Show Validation Error" |
| 43 | + Text="Validation failed for row: [currentRow("Name").ToString]. Please ensure all fields are filled." |
| 44 | + Button="OK" |
| 45 | + Title="Validation Error" /> |
| 46 | + </Sequence> |
| 47 | + </Else> |
| 48 | + </If> |
| 49 | + </Sequence> |
| 50 | + </ActivityAction> |
| 51 | + </ForEach> |
| 52 | + </Do> |
| 53 | + </OpenBrowser> |
| 54 | + </Sequence> |
| 55 | + </Try> |
| 56 | + <Catch x:TypeArguments="s:Exception" DisplayName="Exception Handling"> |
17 | 57 | <Sequence>
|
18 |
| - <ForEach x:TypeArguments="x:String" DisplayName="For Each Row" Values="[extractedData]"> |
19 |
| - <ActivityAction x:TypeArguments="x:String"> |
20 |
| - <Sequence DisplayName="Process Row"> |
21 |
| - <Assign DisplayName="Assign Current Row" To="[currentRow]" Value="[item]" /> |
22 |
| - |
23 |
| - <!-- Enter Data into Web Application --> |
24 |
| - <TypeInto DisplayName="Type Name" Text="[currentRow(0)]" Selector="<your_selector_for_name>" /> |
25 |
| - <TypeInto DisplayName="Type Email" Text="[currentRow(1)]" Selector="<your_selector_for_email>" /> |
26 |
| - <Click DisplayName="Submit" Selector="<your_selector_for_submit_button>" /> |
27 |
| - </Sequence> |
28 |
| - </ActivityAction> |
29 |
| - </ForEach> |
| 58 | + <WriteLine DisplayName="Log Error" Text="[exception.Message]" /> |
| 59 | + <MessageBox DisplayName="Show Error" |
| 60 | + Text="An error occurred while entering data: [exception.Message]." |
| 61 | + Button="OK" |
| 62 | + Title="Data Entry Error" /> |
30 | 63 | </Sequence>
|
31 |
| - </Do> |
32 |
| - </OpenBrowser> |
| 64 | + </Catch> |
| 65 | + </TryCatch> |
33 | 66 | </Sequence>
|
34 | 67 | </Workflow>
|
0 commit comments