Logic App take first 5 characters from the items in array - azure-logic-apps

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,

Related

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()))

What type of datastructure is this: a:114:{s:12:"notification";a:1:{i:0;a:5:{s:8:"email_to";s:24

I'm working with a Wordpress database and want to create some reports on the data. One of the tables contain information which is stored in this format:
a:201:{s:16:"arfmainformwidth";s:3:"550";s:15:"form_width_unit";s:2:"px";s:8:"edit_msg";s:39:"Your submission was successfully saved.";s:12:"update_value";s:6:"Update";s:12:"arfeditoroff";b:0;s:19:" ....}
What I figuered out is that the first letter is the datatype: a = array, s = string ... and the second value is the length.
I saw this format in different other tables from other plugin and want to know how is it called or if there's any type of function which can parse this data. I don't even know how it's called.
I'm working with Wordpress and ARForms. Caldera Forms include this data aswell.
your help would be appreciated
This is the serialized representation of an array. You should be able to unserialize it by calling unserialize() on the string above. This is mostly used when you want to persist a temporary state of an object or you don't want to create database table structures for each and every bit of information.
More to find here:
https://www.php.net/manual/de/function.serialize.php
https://www.php.net/manual/de/function.unserialize.php

Convert CSV elements into a single Array using Azure Logic Apps

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.

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.

How do you store text from a .txt file into a cell array in matlab?

For this project I am doing, I have to analyze tweets off of a company's twitter page. I took the last thirty tweets of this company, and I put it into a .txt document, where each line is a different tweet. I am supposed to store all of the hashtags in a cell array, and then print out these hashtags to the command window. (The hashtags are supposed to include the phrase or words inside the hashtags as well. for example, #matlab #programming #stackoverflow.) I am really confused on how I would store them into a cell array. This is the code, that I have so far. All it does is count the number of hashtags in the entire file.
%% Collecting the hashtags
fid=fopen('twitter.txt');
hashtag=0
nextLine=(fgetl(fid));
while ischar(nextLine)
if regexp(nextLine,'#')
hashtag=hashtag+length(regexp(nextLine,'#'));
end
nextLine=(fgetl(fid));
end
Is there a way to just take the file contents and store it into a cell array with a command, or would I have to manually copy and paste the entire content of the file into something like the variable below and then use a while loop to just access the cell array and use fprintf to print each hashtag out?
hashtagArray={'#...','#..',..}
If your file contains only the text from tweets, load the whole thing into a cell array with textscan (tested with a random selection of made up tweets):
fid=fopen('twitter.txt');
C = textscan(fid,'%s');
C = C{1};
C should now be a cell array of words/hashtags (split by whitespace). We only want the hashtags:
k = strncmp(C, '#', 1); %looks for those with hash at the #start
C2 = C(k);
Note: Officially Twitter considers either whitespace or punctuation to be the end of a hashtag (see this question/answer). So C2 may contain something like #noican't whereas Twitter would recognise the actual hashtag as #noican.

Resources