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

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Using Split with a cou...
Power Automate
Unanswered

Using Split with a count of characters to the left or right?

(0) ShareShare
ReportReport
Posted on by 251

Hi all,

 

I am running into an issue where, I suspect that split has the functionality and i'm simply not looking for the right thing to find the examples i'd like.

 

What i want is to use split like how excel works, where you can count characters to the right or left to exclude/include.

so for instance, i have a message like this:
BTF_CWING_LOW_TEMP **= 2021-11-19 14:10:55

where, i'd like to split on the left by **, but, the character 3rd in the string = could be any of a number of different characters, so, i'd like to split it at the space before 2021, but, i want to account for whatever that character is. so if i were doing this in excel, i'd count 2 to the right when splitting - does that make sense?

I look forward to your responses, and thanks for your time!

 

Categories:
I have the same question (0)
  • ScottShearer Profile Picture
    25,268 Most Valuable Professional on at
    Re: Using Split with a count of characters to the left or right?

    @Seuadr 

    I am not 100% clear on your requirement.  Can you provide a couple of examples of a string and your required output?

     

  • Seuadr Profile Picture
    251 on at
    Re: Using Split with a count of characters to the left or right?

    @ScottShearer 

     

    Sure! so, for instance, i have this message:

    Low Limit out-of-range BTF_CWING_LOW_TEMP **= 2021-11-19 14:10:55


    ultimately, i want to end up with:
    BTF_CWING_LOW_TEMP,
    **=,

    2021-11-19


    here is another example:
    Alarm change-of-state WEL_HW__HX9_HIGH_LIMIT **& 2021-11-17 12:42:48

     

    WEL_HW__HX9_HIGH_LIMIT,

    **&,

    2021-11-17

     

    the characters in the middle - **= and **& are just a couple of examples, there are a number of special characters that could happen after ** so, i was thinking that if i were doing this in excel, i'd first split it at "-" and count 5 characters to the right, giving me:

    WEL_HW__HX9_HIGH_LIMIT **& 2021-11-17 12:42:48

    then i'd split it at "**" and count 1 character to the right, to give me:
    2021-11-17 12:42:48

    and then at "**" to the left, and trim to give me:
    WEL_HW__HX9_HIGH_LIMIT

     

    though, while writing this it occured to me that if i were to split first with a space delimiter i'd end up with:

    WEL_HW__HX9_HIGH_LIMIT,

    **&,

    2021-11-17 

     

    in an array that i could then select elements from?

  • Verified answer
    ScottShearer Profile Picture
    25,268 Most Valuable Professional on at
    Re: Using Split with a count of characters to the left or right?

    @Seuadr 

    I'll be honest - if you can get this done it will be really ugly...  There are too many variables.  For example, the data  at the start of the string (Low Limit out-of-range, Alarm change-of-state )  is not consistent making it difficult to impossible to break out.  

    As you have suggested, you could try splitting on ** and then using a string functions to go to a certain character position, etc.  If you want to go that way, you'll be using the substring(), length(), indexOf(), lastIndexOf() and trim expressions.  

    I'm not saying that you can't get there, but it will be a whole lot of work and what you create may not be bullet proof........

    If you have a premium license, you might try exploring the use of the AI builder functionality.  I suspect that using AI is a better way to go.

     

     

  • Seuadr Profile Picture
    251 on at
    Re: Using Split with a count of characters to the left or right?

    you know, i had not considered AI builder - but i could see where that might be a better option since i could train it to recognize the text i want. thanks!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 497 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 477 Super User 2025 Season 2

#3
chiaraalina Profile Picture

chiaraalina 242

Last 30 days Overall leaderboard