Hey all,
I want to convert some data from big text files (around 7200 lines) to usable variables so that I can get them into Sharepoint.
What I've done so far to try to achieve this is split the text file data so that all \n and \r are gone.
After that I'm using Filter Array function to get the lines with the parameters I need. Now my problem begins: I want to extract specific values of the lines that I then want to use in Sharepoint / PowerApps.
I use a replace, substring and sub function to get the correct keys and values in a Select. But my problem is: the output of the select function is an array where I have one object for each parameter.
This is how my Flow looks
I use the replace functions in the select action with the output of the filter action
Key = replace(substring(item(),lastindexof(item(),']'),sub(lastindexof(item(),'='),lastindexof(item(),']'))),']','')
Value = replace(substring(item(),indexOf(item(),'='),sub(length(item()),indexOf(item(),'='))),'=','')
This is the output I get:
My desired output would be to get something like this OR another, easier solution so that I can use my desired variables and put them into a SharePoint list.
[
{
"Terminal Name:" "Name",
"Terminal Addr": "172....",
.....
}
]
Many thanks in advance!
Solved! Go to Solution.
Hi @vobius ,
Do you want to rebuild this array?
I have made a test for your reference.
variables('orginalarray')[0]?['Terminal Name']
variables('orginalarray')[1]?['Terminal Addr']
variables('orginalarray')[2]?['Terminal Column']
[
{
"Terminal Name:": "@{variables('orginalarray')[0]?['Terminal Name']}",
"Terminal Addr": "@{variables('orginalarray')[1]?['Terminal Addr']}",
"Terminal Column": "@{variables('orginalarray')[2]?['Terminal Column']}"
}
]
Result Screenshot:
Best Regards,
Charlie Choi
Hi @vobius ,
Do you want to rebuild this array?
I have made a test for your reference.
variables('orginalarray')[0]?['Terminal Name']
variables('orginalarray')[1]?['Terminal Addr']
variables('orginalarray')[2]?['Terminal Column']
[
{
"Terminal Name:": "@{variables('orginalarray')[0]?['Terminal Name']}",
"Terminal Addr": "@{variables('orginalarray')[1]?['Terminal Addr']}",
"Terminal Column": "@{variables('orginalarray')[2]?['Terminal Column']}"
}
]
Result Screenshot:
Best Regards,
Charlie Choi
Thank you very much, it worked as expected!