Using for each row in type into

Hi there,

I am trying to get my one of the column from the datatable to type into a remarks field. I use for each row, it is typing by overwriting the same line. I am trying to insert new line by inputting environment.newline but its not working. Anyone can assist me.

Hi @mark_rajkumar1 ,

Can you share a screenshot of your workflow and output?

Hi @mark_rajkumar1 ,

There is not a clear explanation on what you want to perform.

Do you want to Write all the values of the Column into a Single field in the Application ? Or Do you have many fields in the application and want to insert each value one by one into it ?

Hi @mark_rajkumar1

I think that you need to check if your type into activity have the empty field property enabled, you can remove then and your activity will write in the correct way

Regards

Hi @supermanPunch i wan to Write all the values of the Column into a Single field in the Application

@mark_rajkumar1 ,

In that case, maybe try the below expression:

String.Join(Environment.NewLine,DT.AsEnumerable.Select(Function(x)x("Your Column Name").ToString))

You do not have to use For Each activity, Simply try using the above expression in the Type Into Activity and let us know the results.

You can also assign the above expression to a String variable and then use the variable in the Type Into.

@supermanPunch if i wan to add in the date in the expression, the syntax will be what?

@mark_rajkumar1 ,

Not clear on what is needed to be performed.

What was the result observed when/if you have used the above expression. What is the change need to be done according to it ?

@supermanPunch there is an validation error. It says Comma, ‘)’, or a valid expression continuation expected.

@supermanPunch i figure the error out it is .ToString is not together. The syntax work but the nextline doesn’t work. If i want to add another column together and date with lines, what is the syntax?

@supermanPunch i have attached an example how it has to be.

@supermanPunch any advise?

@mark_rajkumar1 ,

Is it possible for you to show How the data was presented by the Expression that I have provided above ?

The Data should have been in next line one after another but only for 1 column.

Also, How do you get this date value ? Is it a separate value that needs to be added together with the Datatable data ?

How many Columns from the Datatable do you want to add together ?

We suggested the initial expression because of the requirement that was mentioned earlier by you.

It was one line with the whole column. I need to add in date as well. I wan to add total 2 columns. I have shared the above example thats the outcome @supermanPunch

@mark_rajkumar1 ,

Give a try with the below :

yourDateVarStr+Environment.NewLine+String.Join(Environment.NewLine,DT.AsEnumerable.Select(Function(x)x("Your Column Name 1").ToString+" "+x("Your Column Name 2").ToString))

Here, yourDateVarStr is the variable which contains the date value (string).

Also if the above doesn’t work, do share what was the output generated by it. We would want to confirm if it is in the format as required.

It pull out the date and columns all correctly except the next line @supermanPunch

@mark_rajkumar1 ,

For further Checking, Could you write it down to a Text file and check if it is in the format ?

Do show us How it is getting represented, we won’t get an actual idea of what is happening otherwise.

@supermanPunch it is showing as one horizontal line as 23-04-23 Column Name 1 Column Name 2 Column Name 1 Column Name 2 Column Name 1 Column Name 2

@supermanPunch when i write in notepad its working as i wanted but type into it does not

@supermanPunch any advise?