Forum Discussion
Split column based on multiple delimiters
- May 31, 2023
Mellissa Perez Run Power automate flow on item creation and/or item update (as per your requirements).
Then perform trim operations as mentioned above in power automate flow using flows expressions (similar functions like substring, indexOf are available).
Save back the trimmed result to SharePoint list using update item action. You can add trigger condition to avoid infinite flow running loop - condition based on whether > is found in the column value.
You can also try calculated column approach to create a new column based on the existing column ( having values with > ). But, you might not be able to use the calculated columns in the SharePoint lookups.
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
Mellissa Perez If you just want to show this trimmed data in list view and not going to use anywhere else (list filtering/sorting, power app, power automate, power bi, export to excel, etc.) later, you can easily achieve it using JSON formatting.
Use JSON like:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=if(indexOf(@currentField, '>')==-1,@currentField,substring(@currentField, lastIndexOf(@currentField, '>')+2, indexOf(@currentField + '^', '^')))"
}
Note, I have used +2 in JSON as I have > and space after each letter like: A > B > C. You can adjust it as per your requirements.
List view before applying JSON:
List view after applying JSON:
Documentation: SharePoint JSON column formatting
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.