I have 3 columns A,B,C. In each column there are 10 rows. Each time i need to copy column A values to clipboard. And these values i need to paste in SAP application by clicking on paste button. I dont wont to read each row and paste into SAP application.
Please suggest any solution for this.
Hi,
You can make use of "Get row item"Activity and pass the column name (A) and pass the output variable to the clipboard.
Thanks for your suggestion. But in my SAP application there are 10 rows in a Column. If I select the first row and click on paste button only one row will get pasted since we are getting single row at a time. Each time i need to read the SAPapplication field and need paste single row at a time. The process is i need to copy 10 rows in column A and paste the same 10 rows in SAP app.
Hey @rao
One simple and will be good for you to use UI automation and open excel file then click on column A then use copy selected activity and set it on clipboard so this thing will be fast and even records will be so much it will take only one time and less activity then you can directly use Get from Clipboard and past in sap.
Regards…!!
AKsh
Try this if you have to do programatically
string.Join(Environment.NewLine,dt.AsEnumerable().Take(10).[Select](Function(s) s.Field(Of String)("ColName")).ToArray())
assign the output to Set to Clipboard activity
Thanks Vaidya. Can you please explain the functions which you have mentioned. I need to understand.
Thanks in advance.
Are you able to paste it into SAP?
- dt.AsEnumerable().Take(10).[Select](Function(s) s.Field(Of String)(“ColName”)).ToArray())
You are converting your DataTable to IEnumerable and then you are taking first 10 rows and converting a specific column into an array
- String.Join & environment.Newline
Converts the output array into a string with newline delimiter.
So the output will be similar to
1
2
3
4
5
No vaiday,
I am getting the error message as " End of Expression expected while assigning to a clip variable.
Assgin:
Clip = dt1.AsEnumerable().Take(10).Select s.Field(Of String)(“sales orders”)).ToArray())
sales orders is my column name
dt1 is my output Datatable.
I have little knowledge in Dot Net. Thanks for the help in advance.
After changing the variable type i am getting the below error message
“Read Range : Object reference not set to an instance of an object.”
sample
sample.xlsx (9.3 KB)
dtEnum.xaml (8.0 KB)
Hey vvaidya!
Would you be able to explain the latter part of this statement. Your solution has worked for me, but I’m trying to understand the mechanics. I haven’t been able to find any documentation on MSDN regarding the select method in brackets. Do you know of any resources that I can look at to learn more about this?
.[Select](Function(s) s.Field(Of String)(“ColName”)).ToArray())
These functions are Lamda Expressions. Please go through below links:
Thanks @vvaidya. The given solutions is works for me if I want only the values from the first row, can you please tell, what we need to write if I want to take the middle of the rows based on a particular row value.
Thanks in advance.
Hi vvaidya,
This is giving only first ten records, what we need to write if i want middle of the rows of column based on a value ?
Thanks,
Murali
how may I do the same thing with a filtered_dt?
can you please help? @vvaidya