Spliting Address Lines in Power Automate

Options

Hi all!

Hopefully you can help me with the issue I'm currently banging my head against the desk about. I've been building out a flow in automate to create prospect profiles for our development officers. I am able to pull almost everything I need out of NXT with correct formatting EXCEPT splitting address1 and address 2 lines through the “List constituent addresses" action.

What my ideal situation would be pulling the address lines from NXT into automate and then putting each line into its own string so that I can populate each field in my word template to fit this formatting:

80cf301eea6c68e50dae737881352e01-huge-im

If I'm missing something and I can already pull add1 and add2 seperately without pulling the entire address lines field (just like you can with city,state,zip) that would be wonderful! Otherwise, knowing a way to separate these two values out as is would be appreciated. I'm more than happy to share any other pics or insights that would help solve this issue I'm having.

Thank you!

Comments

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 PowerUp Challenge #3 Gift Management Name Dropper

    @David Kortes
    you can use the split() expression to split your address lines by newline character(s) dynamic content into an array of individual line. Then use [0], [1] to access the first and 2nd line. What you want to consider is IF there are more than 2 lines, what are your plan?

    Rather than having:
    Addr1
    Addr2

    You can use
    Address Line(s):

    and split out the address lines dynamic content so it looks like this:

    ac0588568a586cb34226e66dcc08a390-huge-im

    If you still want to do the Addr1 and Addr2 route, then:

    Addr1: split(addresslines, ‘\\r\\n’)?[0]
    Addr2: split(addresslines, ‘\\r\\n’)?[1]

    https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#split

    if the split on ‘\\r\\n’ doesn't work, you may need to do a workaround, here's one way to do it:

    https://medium.com/@saikou9901/split-multi-lines-by-new-line-code-d7de3020454c

  • @Alex Wong
    Thank you for the quick response! I wasn't able to get \\r\\n to work but the work around did the job. The reason I want to bring the information in this way is to keep an even formatting between each profile created. It's an attempt to not have to touch the document after it is created and most of the records I will be pulling do not have beyond two lines.

    I'm sure something will break eventually as I still have a lot to learn with automate and all of its quirks. Thank you for this!

Categories