1

In SPO list we have a single line of text, where values are sent as anchor tag e.g <a href="https://SPSITE.sharepoint.com/sites/inspection/Shared Documents/Plant & Equipment/MAINTENANCE/Maintenance Program/Inspection_Vehicle_18082022_075430__3.pdf">Inspection_Vehicle_18082022_075430__3.pdf </a>

WE do not have control on the program that sets this value.

Is there way we can format this with JSON to show as Inspection_Vehicle_18082022_075430__3.pdf inside list?

Basically to rend this text as HTML ? All json format take "txtContent" as parameter. or they need elmType.

or is there a way to do string manipulation?

We are avoiding having another power automate to do string manipulation and extract HREF/Filename value.

1
  • There are few operators available for string manipulation like substring, indexOf. Check the link for more information. Commented Aug 18, 2022 at 14:44

1 Answer 1

0

If the values always follow the same format, then you can extract the values and build a clickable link using this JSON (Column Settings > Format this column > Advanced Mode and then paste the below code):

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "a",
  "txtContent": "=substring(@currentField, indexOf(@currentField, '>') + 1, indexOf(@currentField, '</'))",
  "attributes": {
    "href": "=substring(@currentField, indexOf(@currentField, 'href=') + 6, indexOf(@currentField, '>')-1)"
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.