web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Extract data from an a...
Power Automate
Answered

Extract data from an array

(0) ShareShare
ReportReport
Posted on by 11
Hello everyone,
 
I'm creating a variable to store an array, and then extracting specific fields from it. However, I'm not satisfied with my current approach because I'm relying on the position of the fields within the array. I'd prefer a more dynamic solution that wouldn't break if the structure of the array changes. Is it possible to reference the fields by name instead?
 
Here are my steps: The step "Initialize variable WorkflowWorkItemInstanceID" is not relevant I think.
 
 
 
 
 
 
 
 
The two last nodes give me the data I need: but I use a variables('Array')[20] and variables('Array')[21], and I don't like it because if the structure changes and a new data is added in the array, my flow could return wrong data... Names of fields won't change.
 
Is there a way to get the values I want, dynamically? With the name of the fields in the array?
The values I need are the
VendPay
USP2-00038
 
You can find them below in the array:
 "JournalName:VendPay",
 "JournalNum:USP2-00038",
 
Here is the data of the node Initialize variable Array: 
 
{
    "variables": [
        {
            "name""Array",
            "type""Array",
            "value": [
                "UserBlockId:",
                "Approver:0",
                "AssetTransferType_LT:0",
                "BankAccountId:",
                "BankRemittanceType:0",
                "CurrencyCode:",
                "CurrentOperationsTax:0",
                "CustVendNegInstProtestProcess:0",
                "DefaultDimension:0",
                "DetailSummaryPosting:0",
                "DocumentNum:",
                "EndBalance:0",
                "EUROTriangulation:0",
                "ExchRate:0",
                "ExchrateSecondary:0",
                "FixedExchRate:0",
                "FixedOffsetAccount:0",
                "GroupBlockId:",
                "InUseBy:",
                "JournalBalance:0",
                "JournalName:VendPay",
                "JournalNum:USP2-00038",
                "JournalTotalCredit:0",
                "JournalTotalDebit:0",
                "journalTotalOffsetBalance:0",
                "JournalType:4",
                "LedgerJournalInclTax:0",
                "LinesLimitBeforeDistribution:0",
                "Log:",
                "Name:Vendor payment",
                "NumberSequenceTable:22565451990",
                "NumOfLines:0",
                "OffsetAccountType:6",
                "OffsetLedgerDimension:0",
                "OriginalCompany:",
                "OriginalJournalNum:",
                "ParentJournalNum:",
                "PaymentsGenerated_IT:0",
                "Posted:0",
                "PostedDateTime:01/01/1900 00:00:00",
                "ProtestSettledBill:0",
                "RejectedBy:",
                "RemoveLineAfterPosting:0",
                "ReportedAsReadyBy:",
                "RetailStatementId:",
                "ReverseDate:01/01/1900 00:00:00",
                "ReverseEntry:0",
                "SessionId:0",
                "SessionLoginDateTime:01/01/1900 00:00:00",
                "SystemBlocked:0",
                "TaxObligationCompany:0",
                "VoucherAllocatedAtPosting:0",
                "WorkflowApprovalStatus:0",
                "IsLedgerDimensionNameUpdated:0",
                "ReportingCurrencyExchRate:0",
                "ReportingCurrencyExchRateSecondary:0",
                "ReportingCurrencyFixedExchRate:0",
                "JournalTotalCreditReportingCurrency:0",
                "JournalTotalDebitReportingCurrency:0",
                "IntegrationKey:",
                "DelayTaxCalculation:0",
                "OverrideSalesTax:0",
                "FinTag:0",
                "IsAdjustmentJournal:0",
                "SystemBlockedReason:0",
                "SimulationPosted_IT:0",
                "BankTransSummarizationEnabled:0",
                "BankTransSummarizationCriteria:0",
                "AssetLeaseProcessId:00000000-0000-0000-0000-000000000000",
                "RevRecReallocationId:"
            ]
        }
    ]
}
 
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Cgangweg01 Profile Picture
    876 Super User 2026 Season 1 on at
     
    There are probably multiple ways to do it that others may suggest.
    Here is how I got the array down to just the values you want using filter array.
    Then you can do a select action to prepare for the rest of the flow.
     
    Created array variable with your content:
     


    Use advance filter to compound the or startswith statement by field name:
     
    or(startsWith(item(),'JournalName:'), startsWith(item(),'JournalNum:'))
     
     
     
    Results:
     
    Hope that helps. I can figure out the Select action if you want.
    Might have to do a Split function to get the values separated from field name.
    Please mark this answered if it helps solve your issue.
     
  • Tomac Profile Picture
    4,105 Moderator on at
    I tried but couldn't get the key/value pairs into a flat array for easy reference, so I have to tap out.
     
    I'm going to tag @Chriddle in on this one, he's an absolute wizard with arrays and JSON parsing and if anyone can get your data into a better format it's him.
  • Verified answer
    Michael E. Gernaey Profile Picture
    53,963 Moderator on at
     
    You can do this.
     
    Where my Example Data is just your entire Object
    I then simply use these two expressions, one in each Compose and bingo the value and it wont matter where it is in the string
     
    split(split(string(variables('ExampleData')),'"JournalName:')[1],'"')[0]
    split(split(string(variables('ExampleData')),'"JournalNum:')[1],'"')[0]
     
     
     
    the flow
     
     
     
    I copied out your data
     
     

    If these suggestions help resolve your issue, Please consider Marking the answer as such and also maybe a like.

    Thank you!
    Sincerely, Michael Gernaey
  • Cgangweg01 Profile Picture
    876 Super User 2026 Season 1 on at
    Hello @LeoRoma
    I learn so much from this community even with posts that I attempt to help!
     
     
     
    Michael, just following up to see if I could use the expression you provided in a select action to create an object array with the key/value pair. Hope that makes sense. It kind of worked but for some reason created two objects.
      
    Can you please describe why? How would you get what I was trying to do?
     
     
     
     
    Selecting from body of the filter array action, mapping the two fields using the two expressions you provided ...
     
    Results output ...
  • Verified answer
    Michael E. Gernaey Profile Picture
    53,963 Moderator on at
     
    So think of it like this.
     
    You are using a Select. The Select is pulling 2 Rows from the Filter essentially.
     
    Each Row is being created using pointers to data outside the actual Select Input (that came from the Filter). Since my expressions go directly against my variables.
     
    If you tried to use like item() to grab the data for each row it would actually fail because each row does not have those Properties in it.
     
    heck you could add another named property and put my expression (either) and you'd just have a 3rd property with the value.
     
    So Filter = 2 rows
    Select gets 2 rows
    Loops through them
    Each Row actually creates 2 Arrays because of the fact that it has 2 properties, both defined against data outside the scope of the Select itself, which is not only legal, but causes it to SEEM like there is data in both fields in both Rows, when there isn't... its a false positive

    If that makes sense.
     
    So to fix yours, I would re-write it or.. and this is just for kicks sake.
    Add a compose after the select (which I put in advanced mode)
     
    union(body('Select'),body('Select'))
     
    and ignore that the input looks like there was NO duplicates its a bug. The Select had it

    If these suggestions help resolve your issue, Please consider Marking the answer as such and also maybe a like.

    Thank you!
    Sincerely, Michael Gernaey
     
     
     
     
  • Cgangweg01 Profile Picture
    876 Super User 2026 Season 1 on at
    @LeoRoma Apologies if I'm muddying anything for your solution. Michael's earlier reply will get you to the values.
     
    @Michael E. Gernaey - thank you for the reply.
    That worked in my flow which I now know is a bit of a hack.
     
     
     
    For future reference for me and others, below is exactly what CoPilot said when prompted to describe this compose union expression.
     
    **************************************************************************************

    The Power Automate cloud expression:

     

    union(body('Select2'), body('Select2'))

     

    is using the union() function, which is designed to combine two arrays and remove duplicate items.

     

    What it's doing:

     

    • body('Select_2') refers to the output of a previous Select action named Select_2.

    • The union() function takes two arrays as input and returns a new array containing all unique elements from both arrays.


    •  
     

    In this case:

     

    Since both inputs are identical (body('Select_2') used twice), the result will be:

     

    • An array that contains only the unique items from Select_2.

    • Effectively, this is a way to remove duplicates from the array returned by Select_2.


    •  
     
     
  • Michael E. Gernaey Profile Picture
    53,963 Moderator on at
     
    If I answered anyones question :-) i'd appreciate them marked as please and thanks!!
  • Michael E. Gernaey Profile Picture
    53,963 Moderator on at
     
    And just FYI, its not a Hack, although I believe you mean it in your scenario specifically :-)
     
    The reason I shared it is because its the primary use case for sending, for instance, grouped emails to a single person, where you have to iterate through unique lists :-) . And bah Copilot ;-) lol.
  • LeoRoma Profile Picture
    11 on at
    Thanks a lot, it works fine now!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 784

#2
Valantis Profile Picture

Valantis 581

#3
Haque Profile Picture

Haque 545

Last 30 days Overall leaderboard