Im parsing a list of emails from a table but the last rows is not an email, how can I remove it from the extraction? The only change will be the #s of records all other characters will remain the same.
Hi @carlosdajer , I may have a solution for you.
This works only if your data is always formatted like you've described and the second-to-last line always has an email ending with ".com".
Here's the expression.
Gets position to the " of the last "com"
add(4,lastIndexOf(variables('varemovelastline'),'com'))
Gets the string up to the last "com" and adds a "]" to close the array.
concat(Substring(variables('varemovelastline'),0,add(4,lastIndexOf(variables('varemovelastline'),'com'))),']')
Hope this helps,
Aman
------------------------------------------------------------------------------------------------------
If my post helps you with your problem or answers your question, please mark it Solved or Answered. This helps anyone with similar challenges. If you like my response, please give it a Thumbs Up.
------------------------------------------------------------------------------------------------------
@carlosdajer - You can use split function to split the string by comma as delimiter and store it to array variable. Then just ignore the last element of array and use the rest.
Like and Mark this as an answer if it resolves your issue.
@PrasadAthalye Thanks for the answer but what I want is actually that, how can I ignore the last and keep the rest (emails)
Use the below expressions on your variable
substr(yourvariable,0, length(your variable) - 1)
It works on the test but when I use my append to string variable with the new expression it shows like this:
How can I extract it so it will keep the same format
Do you mean it looks like an array?
Yes. To give more context, Im extracting a table, grabbing the email column, joining the emails together separated by comma using join function, but last row is not an email (Grand Total (22 records), @Amanthaper Solution works on a testing enviorement (inputting the data) but with the join function or the strings coming out of it, I can't make it work.
See image below
@carlosdajer - Thanks for the context. Instead of Join, can you run a for each loop on the table? Then inside the loop add a condition? Within the condition, check if string contains '@' or not, If yes, append the string to string variable along with comma.
This should give you exactly what you are looking for...
Like and Mark this as answer if it resolves your issue.
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!
User | Count |
---|---|
40 | |
36 | |
36 | |
34 | |
27 |
User | Count |
---|---|
39 | |
38 | |
34 | |
31 | |
25 |