Returning information via URL from Child Survey to Parent Survey

3 years 10 months ago #95648 by cshaw
I have a Parent Survey (sid: 691757) that contains a link (FHLINK) to a Child Survey (sid:579758). I want the user to select the link, fill in information about their female relative with cancer in the Child Survey, and have the Child Survey’s End-URL redirect back to this question on the Parent Survey returning the relative type which I want to use to populate a Long free text value on the Parent Survey.

Everything is working except the revision of the long free text when returning from the child survey. The returned End-URL from the Child Survey is: ""

SO how do I get "Mother" out of the URL and append it into the Long free text (RelativeList) question on the Parent Survey?

Please Log in to join the conversation.

3 years 10 months ago #95734 by cshaw
I know this can't be too hard, so I'd appreciate if you all could help me out.

I have placed two surveys on the test site: Survey_Parent and Survey_Child. The parent contains tokens 1001 to 1005 for testing purposes.

Survey_Parent has tokens initiated and contains the fields: fhlink and femalerellist

Survey_Child does not have tokens initialized and contains the fields: packet and reltype.

Survey_Parent contains a hyperlink to the Survey_Child from the field fhlink. The link is: <a href="{TOKEN }">Add Female Relative Cancer History ({TOKEN})</a>
Following the link populates the Survey_Child field "packet" with whatever the Survey_Parent table's current token is.

To return users to the Survey_Parent, the Survey_Child has this End-URL:{Packet }

On the Survey_Child selecting "Daughter" for the relative type and then pressing the submit button activates the following URL:

Here is where things start to fail. Following the last link triggered by the End_URL from submission of the Survey_Child does get you back to the Survey_Parent with the correct token. However I can not seem to figure out how to populate the Parent_Survey field "femalerellist" with the reltype from the Survey_Child, "Daughter" for example despite the field appearing quite clearly in the URL.

SO HOW do I get "Daughter" out of the URL and into the short text femalerellist on the Parent_Survey???

I want some command like: {substr(URL,x,y)} or maybe I need some java script to be activated that reads the URL. IS there a standard way?

Here are links to the two surveys so you can see for yourself:

Link to Survey_Parent administration:

Link to Survey_Child administration:

Login on test site: admin
Password on test site: test

Thanks in advance for any help you can give!


Please Log in to join the conversation.

3 years 10 months ago #95743 by tpartner
Try using the SGQA instead of the question code to populate the question. So, this would be the end URL of the child survey:{packet}?691757X38X113={reltype.shown}

Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: cshaw

Please Log in to join the conversation.

3 years 10 months ago - 3 years 10 months ago #95750 by cshaw
Perfect that worked!

The next challenge is that I want to keep a visual record of the relatives that have been entered in the Survey_Child in the Survey_Parent.

So I changed the field name of (691757X38X113) to femalerel, and added a new field to Survey_Parent, femalelist of type long free text. Now when I return from entering a Survey_Child, I want to take the value of the Survey_Parent field femalerel and append it to the value in the new Survey_Parent field femalelist.

If any of you know off of the top of your head how to do this, I would appreciate the hint. In the meantime I am digging into the docs to see if I can figure it out myself. I am thinking some example tests may contain that kind of example.

Thanks again!

Last Edit: 3 years 10 months ago by cshaw. Reason: Clarification

Please Log in to join the conversation.

3 years 10 months ago - 3 years 10 months ago #95760 by cshaw
I have continued to work on this, with no wonderful solutions yet.

My first approach was to pass the relative selected on the child survey back to the parent survey via the End-URL and store the relative returned in a long free text field (femalerel) on the parent survey.

The big idea is that users can continue to select as many relatives as needed selecting the link to the child survey over and over again. I need to accumulate the answers for display in the parent survey users so know what has been entered already in the child survey, so the first approach only got me part way.

So my second solution is that when the user selects the link to the child survey again, the value of the long free text field in the parent (femalerel) is passed back to the child survey and stored in a hidden field (lastrel) of type long free text.

In the next step the user selects the next relative in the child survey and the relative is appended to the answer in the hidden long text field (lastrel). But durn if I know how to do that! So instead I put the value from the hidden field and the new relative the user selects into the question text for the hidden long free text (lastrel)

So my plan is to utilize the child survey End-URL to pass back the lastrel.question to populate the parent survey field femalerel. It sort of works, but I am getting pesky html interference rather than just the answers passed around.

The surveys are up on the test site. To look at them there use the username: admin and the password: test

The parent survey is:

The link to the child survey is:
<a href="{femalerel }">Add Female Relative Cancer History</a>

The child survey is:

The End-URL in the child survey is: }

I am trying to avoid use of the token table too much because I may need to deploy on a previous version. I will probably run into gottchas even so whenever I stray away from using SGQA syntax. But I plan to cross those bridges later.

Last Edit: 3 years 10 months ago by cshaw. Reason: Just making clearer

Please Log in to join the conversation.