Skip to main content

Using Nintex Forms, from a sub-site, when a person opens a link to a new form located in the top-level site, the source= url string is copied into a field using the formula: fn-GetQueryString(Source)

This pastes the url string when the form is loaded as: http://SpServer.com/sites/Programs/1/Pages/default.aspx   (So depending on which sub-site, 1, 2, 3 etc is the sub-site).

So what I now need is to display the corresponding Sub-Site Name in a field. I have tried common:Site Name but this displays the top-level Site Name, which is no good.

I have another list that was used to create the sub-site using the Create Site Workflow and that has the corresponding Site Name, so I can use a lookup if I can get the 1, 2, 3 etc from the source string url.

The URL path after the 1, will be dynamic, so it could be /1/Pages/Lessons.aspx, /3/Pages/Risks.aspx etc.

Is there a way perhaps using Trim or Replace, that I can extract the sub-site 1, 2, 3 etc at runtime?

 

Ask if anything is unclear.

Thanks.

something like following should work.

I'll assume http://SpServer.com/sites/Programs/ is your site URL.

use calculated value control with following formula

replace(replace({TextStart}QURL{TextEnd},{TextStart}{Common:WebURL}{TextEnd}+"/",""),'\/[\w\/\.]+$',"")

note QURL is name of field which you populate with with query string, so replace it in formula with respective named control reference.

‌ part of path‌


Wow, thanks Marian! That works!

Thank you so much, you have saved me a huge amount of change-formula, publish form, refresh page, test, repeat.

Amazing.


To add a reference to a a column works well, however, be sure to create log history for the column it is replacing to see what is actually being trim/replaced.Both columns have to be SLT to work effectively; Also, an empty title is returned when a work flow constant is used to set a field value for first column to a work flow constant from form that utilizes a custom expression when a SLT control is enabled and set to the Trim variable for column trying to replace. Is there a way to set the field value to return the value utilizing the error message validation instead of automatically updating the column with the trailing spaces? I.E. Title field is replaced with zero when a set field is set for Title Column A and replaced Column B with zero instead of replacing the Column with column data that nulls out the string and defaults to Title. It seems to only work with the form custom expression and limited in work flows what you can actually set the value to copy the content from Column A to Column B while trimming the column contents of leading/trailing/commas/periods. Thanks. 


Reply