RPA: Add code stage to copy collection rows to windows clipboard in Blue Prism.
Environment Setting
Go to Initialse tab in the object.
Double click the initial block in initial tab.
In "Business Object Properties", switch to "Code Options" tab.
Add the External References and Namespace Imports as the following image.
Code Stage
In the object, drag a new [Code] stage.
Inputs column
The inputs variables:
Outputs column
The outputs variables:
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
Try Dim StrBuilder As New StringBuilder If Start_Row < 0 Then Throw New ApplicationException("Start Row must be at least zero.") End If Dim LastIndex As Integer = Source_Collection.Rows.Count-1 If Start_Row > LastIndex Then Throw New ApplicationException("Start Row must not beyond the end of the collection.") End If If Start_Row + Number_of_Rows_to_Copy - 1 > LastIndex Then Throw New ApplicationException("The number of requested rows extends beyond the end of the collection." & Start_Row.ToString() & Number_of_Rows_to_Copy.ToString() & LastIndex.ToString()) End If 'Set up the new collection with columns 'For J As Integer = 0 To Source_Collection.Columns.Count - 1 ' Output_Collection.Columns.Add(Source_Collection.Columns(J)) 'Next 'Output_Collection.Columns.Add(Source_Collection.Columns(0)) 'copy the requested rows on by one For I As Integer = Start_Row To Start_Row + Number_of_Rows_to_Copy - 1 Dim Values(Source_Collection.Columns.Count - 1) As Object 'For J As Integer = 0 To Source_Collection.Columns.Count - 1 Values(0) = Source_Collection.Rows(I)(0) 'strBuilder.Append(Values(0) & Chr(9)) strBuilder.Append(Values(0)) 'Next 'Output_Collection.Rows.Add(Values) strBuilder.AppendLine() Next Clipboard.SetDataObject(StrBuilder.ToString, True) Success = True Catch Ex As Exception Success = False |
留言