Welcome, Guest
Username: Password: Remember me

TOPIC: Returning information via URL from Child Survey to Parent Survey

Returning information via URL from Child Survey to Parent Survey 1 year 3 months ago #95648

  • ohvelma
  • ohvelma's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 39
  • Thank you received: 1
  • Karma: 1
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: "nmtstudy.limequery.com/index.php/survey/.../RelativeList/Mother"

SO how do I get "Mother" out of the URL and append it into the Long free text (RelativeList) question on the Parent Survey?
Attachments:
The administrator has disabled public write access.

Returning information via URL from Child Survey to Parent Survey 1 year 3 months ago #95734

  • ohvelma
  • ohvelma's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 39
  • Thank you received: 1
  • Karma: 1
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="demo.limesurvey.org/index.php/?sid=57975...579758X39X168={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: demo.limesurvey.org/index.php/survey/ind...691757/token/{Packet}

On the Survey_Child selecting "Daughter" for the relative type and then pressing the submit button activates the following URL: demo.limesurvey.org/index.php/survey/ind...id/691757/token/1001

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: demo.limesurvey.org/index.php/admin/surv...view/surveyid/691757

Link to Survey_Child administration: demo.limesurvey.org/index.php/admin/surv...view/surveyid/579758

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

Thanks in advance for any help you can give!

Carole
The administrator has disabled public write access.

Returning information via URL from Child Survey to Parent Survey 1 year 3 months ago #95743

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4141
  • Thank you received: 768
  • Karma: 349
Try using the SGQA instead of the question code to populate the question. So, this would be the end URL of the child survey:
http://demo.limesurvey.org/index.php/survey/index/newtest/Y/lang/en/sid/691757/token/{packet}?691757X38X113={reltype.shown}
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
The following user(s) said Thank You: ohvelma

Returning information via URL from Child Survey to Parent Survey 1 year 3 months ago #95750

  • ohvelma
  • ohvelma's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 39
  • Thank you received: 1
  • Karma: 1
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!

Carole
Last Edit: 1 year 3 months ago by ohvelma. Reason: Clarification
The administrator has disabled public write access.

Returning information via URL from Child Survey to Parent Survey 1 year 3 months ago #95760

  • ohvelma
  • ohvelma's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 39
  • Thank you received: 1
  • Karma: 1
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:
demo.limesurvey.org/index.php/admin/surv...view/surveyid/691757

The link to the child survey is:
<a href="demo.limesurvey.org/index.php/?sid=57975...58X39X316={femalerel}">Add Female Relative Cancer History</a>

The child survey is:
demo.limesurvey.org/index.php/admin/surv...view/surveyid/579758

The End-URL in the child survey is:
demo.limesurvey.org/index.php/survey/ind...9758X39X316.question}

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.
:)

Carole
Last Edit: 1 year 3 months ago by ohvelma. Reason: Just making clearer
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.130 seconds
Donation Image