Convert CSV elements into a single Array using Azure Logic Apps - arrays

I have a csv file which has the following sample values
ReportId,ReportName
1,Poy
2,Boy
3,Soy
I want this to be converted into a single array like
[ReportId,ReportName,1,Poy,2,Boy,3,Soy]
using logic apps.
Is this possible?

You could refer to my below flow. Init a csv data, then split with expression split(outputs('Compose'),'\n'), you need to go to code view to edit the expression, or it would be split(outputs('Compose'),'\\n').
Then do the loop action to get the single data. The for each 2 input is split(item(),','). Then append the current item to the array.
Here is my result.

Related

Logic App take first 5 characters from the items in array

I would like to be able to extract the first 5 characters from the element in the array in Logic App. I am able to generate the list (below image) but I need only first 5 characters not the whole name
and here is the result
Thank you :)
Using substring function you can extract first five characters of the file name. I have reproduced issue from my side and below are steps I followed,
Created logic app as shown below,
Taken http trigger and then initialized a variable of type array.
Next listing Azure blobs in storage account.
In foreach loop, iterating over list of blobs and then appending display name of blob to array variable. Here using substring function to take first 5 characters of file name with expression,
substring(items('For_each')?['DisplayName'],0,5)
Creating blob with using content as array variable output.
File names in storage account displayed as shown below,
Logic app ran successfully and blob created in storage account as shown below,

How to save bucket names to a string and add new ones after that to an array

i have planner buckets (Tasks, in progress, Backlog) and I want to create a new Bucket depending on elements in a SharePoint list.
But I can't save the bucket names to an array and then add the missing value e.g. like "on hold" and the go trough the array again. It always set my array to blank again.
Maybe you can help me. Here is my PowerAutomate Flow so far:
You could use a couple of Select actions to create two arrays which you can use for the comparison. With a Filter Array you can find the ones which are missing. The output of that Filter Array can be used to loop through and create the missing buckets.
Below is an example of that approach.
1. In both Select actions the Map field is switched to text mode to only get Arrays with values (without keys)
2. In the Filter Array this is used in the From
body('Select_-_SharePoint_Items')
3. And this is the expression used in the advanced mode
#not(contains(body('Select_-_Existing_Buckets'), item()))

How to transform a list of numbers into seperate elements talend tmap

I have a list of codes for each state as an input stored in a table.
What I want as output is this , using tmap transformations
This is the job I made but it doesn't seem to work correctly like I want. The output should have 1000 rows.
Does anybody know how to solve this?
One way to do this is to convert your list to a string of comma-separated values (using tConvertType for instance) and then use tNormalize to split this string into individual rows.

How to change the order of the compose connector in logic apps(azure). By default it is asc order

I get the data in a json format, in which i have table details (it has n number of rows and columns ). I want to send a mail and include the row details in the mail body. Right now i am able to send the mail and include the row details. I am using a compose connector to define the required rows. But the output is always in ascending order.(I want to display Message column first and then the Count column, but i always get Count column first and then Message column) I want to customize the output.
I tried using initialize connector but since i am using the for-each loop i can not use Initialize connector. (Initialize connector have to be initialized at top.
Before triggering the logic app
After triggering the logic app
Current output i am getting:
I want to customize the output i.e Message column first and then the count column
This is an expected behaviour that shouldn't have side effects if you stick to the JSON format. It's because JavaScript JSON libraries default to alphabetical ordering of properties.
However if you insist on custom order, you could refer to my answer before create new json object using compose connector. You need create a string with the input you want the compose it or parse it to json.

How to write a List(of String) into a SQL Server table where each string is a comma separated list of values

We have survey data for each survey on a server. The data is separated with one method I can download the column names (via pooling) and with another I can download the data (via SSE). I have accomplished to write a procedure that creates a datatable dynamically for each survey I choose to download. Now I have to get the data into that table. For this I have streamed the data via SSE into a List(of String) where each element comprises a comma separated string.
This looks like
For Each x As String In stringList
Console.WriteLine(x)
Next
would give me
(1)data:[1,2,1,5,2,6,John,Winchester,234]
(2)data:[5,3,2,4,1,6,Mike,Lenchester,555]
...
Each Element of the List is a dataset I have to put into one column of my datatable. So I guess I have to loop through the List Object and the pick each element between the comma and write them into the columns.
So my problem now is to get the data into the database.
Usually I provide an approach but this time I have no clue how to start.
I tried to experiment with this
.Parameters.Add("#id", SqlDbType.varchar(max)).Value = x
but ended up in frustration.
Could anyone give me something to start with? The data size is up to 500MB if I store it in a .txt file.

Resources