cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
IMAX99
Helper I
Helper I

Find / Extract the first character of a string

This seems like it should be simple but I just can't find a way to extract the first character of a string. There's no pattern to the strings so I cannot use split or substring. What a I need is something like Left([string],1) but I just can't see how to do this in Power Automate.

6 REPLIES 6
yashag2255
Dual Super User II
Dual Super User II

Hi @IMAX99 

 

Can you try 

 

substring('string',0,1)

 

This will return 's' in this case. You can replace the 'string' by selecting a variable output or any text output from the dynamic selector. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Already tried that but get an error 'substring' parameter is out of range....

yashag2255
Dual Super User II
Dual Super User II

@IMAX99 

 

Can you check if the string you are trying to pass actually has some text value? or is it Null? As we are extracting the first character, if the value being passed is null, it will return that error. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

The string is coming from an array. I'm using the split function to separate out the values. This working great so I know the values exist. One of these items contains a text value for a 'Company' name and what I'd like to do is extract the first character from this item.

yashag2255
Dual Super User II
Dual Super User II

@IMAX99 

 

Can you share a snippet of how you are passing this value to the function? 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

PA snapshot 3-9-20a.pngPA snapshot 3-9-20b (2).pngDesign and run time with error message. This is using the expression '

substring(split(item(),',')?[0],0,1)

'

The data is coming in from a CSV file, hence the split by comma. 

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Users online (2,246)