qlist custom calculated field - parse URL - SharePoint Customization - SharePoint for All - Dell Community

qlist custom calculated field - parse URL

qlist custom calculated field - parse URL

This question is not answered

I am using a qlist web part custom field to parse a section of a url. 

for example

We need to get the current item url, and display any one of the segments of the url for example:

If the URL = https://servername/sites/subsite1/subsite2/subsite3/doument.doc

How do we display the value of a portion/particular segment of this url?

For example, I want to display /subsite2 in a custom column using the qlist web part.

Could someone please provide me a code snippet that can be used in the calculated element in the custom field? Is there any alternative ways of performing this, if so could you elaborate?

 

All Replies
  • Hi there,

     

    You can try to use the ‘Calculated Value’ setting in Custom Field, something like this:

    <a href= https://servername/sites/subsite1/subsite2/subsite3/<%Name%>>/subsite2</a>

     

    Kenny.

  • Hi Kenny,

    Thanks for the quick reply, unfortunately this is not what we are trying to do.  We need to enumerate the current item URL automatically and have it parsed into segments that we can display each segment in its own custom fields when viewing the list in the qlist web part.

    For example:

    Custom column1 - https:// 

    Custom column2 - server.domain.com 

    Custom column3 - site collection

    Custom column4 - sub site1

    Custom column5 - document or item name

    etc...

  • Hi,

    I think you should have a rule about which custom column has which segments. You can write some JavaScript into Calculated Value setting to implement the rule logical. For example, the ‘<%Type%>’ filed contains the current item’s URL information, and you can use this field for you script logical.

    Kenny.