Welcome, Guest
Username: Password:
  • Page:
  • 1
  • 2

TOPIC: Pre-population of questions.....

Pre-population of questions..... 4 years 4 months ago #71331

  • rocksalt
  • rocksalt's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
I work for a IT outsourcing company in the UK. We have a custom built PHP driven script linked to our call management system ( Remedy by BMC ) which automatically emails out to select customers, a questionnaire link that facilitates certain questions relating to the helpdesk experience.

Of late, this system is becoming unmanageable, so we’ve looked around and came across Lime survey.
I’ve installed Version 1.91+ Build 11343, set up some survey’s and gotten some general opinions and it’s all good so far.

However I’ve hit a stumbling block that none of the tutorials, workarounds or forum entries seems to expand or mention…..

The current format of the call closure email offers a link for the user to click on that leads them to the survey….. this is generated via a HTML page that is a template embedded to the call notification email sent out upon completion of the call. This template take information from our call logging database ( Oracle ) to extract information like “call reference number”, “customer contact name”, “Site location” and “telephone number” etc…

Trying to get the new survey to work with our existing auto notification e-mails.. the url might looks something like this:

limesurvey.local/index.php?sid=17999&lan...44Xq4=#$$Cust_loc$$#

In order to do this, I must be able to extract information from the notification mail and insert this into the survey….

Dear #$$Contact Name-Main$$#

Asset No #$$Asset No.$$#
Serial No. #$$Serial No.$$#
Customer Ref #$$Customer's Reference$$#
Create Date #$$Create Date$$#
Fault Description #$$Fault Description$$#
Solution #$$Solution$$#

Call #$$Request ID$$# has been Resolved.

We trust that this call has been dealt with to your satisfaction, and would be grateful if you could take a couple of minutes to complete our online Customer Satisfaction Survey:

ENGLISH

FRENCH

POLISH

Czech

I know I can use the language in lime survey so ignore the language options above…. Its just an example of our closure email…. The fields surrounded by # are the data that automatically gets populated by the remedy system.. this is what I would like to use to populate the questions……. Using SGQA maybe ?
I think I need to be able to parse

Customer Ref
Call
And DEAR fields as above.. but im not sure how to do this with limesurvey.

Alternatively… I could drag this information direct from the database, but again, I cannot find any information on how to do this.

Has anyone had any experiences like this ?

Regards

Mark
Last Edit: 4 years 4 months ago by rocksalt.
The administrator has disabled public write access.

Aw: Pre-population of questions..... 4 years 4 months ago #71334

  • Steve
  • Steve's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 493
  • Thank you received: 46
  • Karma: 17
Hello,

I think it depends on the requirements you have and if you can wait for further releases or not. One idea might be using the ExpressionManager in the upcomming LimeSurvey 1.92 but I'm not sure if it could handle this (I think TMSWhite can answer this question). Another possible option would be using the URL parameters which should be available in LimeSurvey 2.0.

If you need to have a solution as fast as possible I think these two ways would be possible (and easy done) using LimeSurvey 1.91+.

1. Using Javascript within your design template
Go to the Template editor. If you are using a standard design template you can copy it and change the elements shown on different pages. If the mentionded text is used on the welcome page that would be the Screen "Welcome page" and the standard file(s) "welcome.pstpl". There you can edit the message the way you want and even add some Javascript that reads the parameters from the URL, extracts them and write them into the page. I think you could either do it by writing the whole message with javascript or using the template.js file to manipulate the container containing the welcome message.

2. Using Javascript within your welcome page in the survey options
If you want to do it this way you have to disable the "Filter HTML for XSS" option in the "Security" tab of the "Global settings". Then you can use Javascript inside your survey. So you can edit the text element(s) "Welcome message" and add some Javascript that does the same mentioned in point 1.
Mit freundlichen Grüßen/Best regards,

Stefan Gohlke
LimeSurvey Team
The administrator has disabled public write access.

Aw: Pre-population of questions..... 4 years 4 months ago #71336

  • rocksalt
  • rocksalt's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
cool. Thanks for your response.
I think option 1 has a lot of merit, ill have to look into this, java not being my strong suit here... but i might be able to find a script that can pull the information via ODBC from the DB and then present it to LS, but how can i get it to know what to look for in the first place? it must be able to read something.. maybe in the URL? and then parse that to a query that will then use it to pull the data from the DB ?
The administrator has disabled public write access.

Aw: Pre-population of questions..... 4 years 4 months ago #71339

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5780
  • Thank you received: 1258
  • Karma: 514
Given a URL something like:
limesurvey.local/index.php?sid=17999&lang=en&6X44X11=ContactNameMain&6X44X22=AssetNo&6X44X33=SerialNo&6X44X44=CustomerReference&6X44X55=CreateDate&6X44X66=FaultDescription&6X44X77=Solution&6X44X88=RequestID

You could hve HTML something like this in the welcome message:
Dear <span class="contactName">&nbsp</span><br />
<br />
Asset No <span class="assetNumber">&nbsp;</span><br />
Serial No. <span class="serialNumber">&nbsp;</span><br />
Customer Ref <span class="contactName">&nbsp;</span><br />
Create Date <span class="createDate">&nbsp;</span><br />
Fault Description <span class="faultDescription">&nbsp;</span><br />
Solution <span class="solution">&nbsp;</span><br />
<br />
Call <span class="RequestID">&nbsp;</span> has been Resolved.

And then a script like this will grab the URL parameters and populate the <span> elements in the welcome message:
<script type="text/javascript" charset="utf-8">
 
	function getURLParameter(name) {
		return decodeURI(
			(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
		);
	}
 
	$(document).ready(function() {
		$('.contactName').text(getURLParameter('6X44X11'));
		$('.assetNumber').text(getURLParameter('6X44X22'));
		$('.serialNumber').text(getURLParameter('6X44X33'));
		$('.contactName').text(getURLParameter('6X44X44'));
		$('.createDate').text(getURLParameter('6X44X55'));
		$('.faultDescription').text(getURLParameter('6X44X66'));
		$('.solution').text(getURLParameter('6X44X77'));
		$('.RequestID').text(getURLParameter('6X44X88'));
	});
 
</script>
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The administrator has disabled public write access.
The following user(s) said Thank You: Steve, rocksalt

Aw: Pre-population of questions..... 4 years 4 months ago #71343

  • Steve
  • Steve's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 493
  • Thank you received: 46
  • Karma: 17
Hello,

sorry if I missunderstood but do you have an URL like
limesurvey.local/index.php?sid=17999&lang=en&6X44X11=ContactNameMain&6X44X22=AssetNo&6X44X33=SerialNo&6X44X44=CustomerReference&6X44X55=CreateDate&6X44X66=FaultDescription&6X44X77=Solution&6X44X88=RequestID
or do you have to create this URL yourself?

If you allready have this kind of URL you can use the sollution provided by tpartner, you don't have to get any information from the oracle database in LimeSurvey because you allready have the information in your URL parameters.

@tpartner:
There is a copy/paste error in your scripts
Customer Ref <span class="contactName">&nbsp;</span><br />
should be something like
Customer Ref <span class="customerRef">&nbsp;</span><br />
and
$('.contactName').text(getURLParameter('6X44X44'));
has to be changed to
$('.customerRef').text(getURLParameter('6X44X44'));
.

If you only need the information from the URL on the welcome page and you don't use the SGQA code to prefill an answer of question X you don't have to use the SGQA. You can used parameters that are easier/more easy to read. For example
limesurvey.local/index.php?sid=17999&lang=en&conName=ContactNameMain&assNo=AssetNo&serNo=SerialNo&cusRef=CustomerReference&creDa=CreateDate&desc=FaultDescription&sol=Solution&reqID=RequestID
and change it in both the HTML and Javascript code. But as said before it depends on what you want to do.
Mit freundlichen Grüßen/Best regards,

Stefan Gohlke
LimeSurvey Team
The administrator has disabled public write access.
The following user(s) said Thank You: rocksalt

Aw: Pre-population of questions..... 4 years 4 months ago #71344

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5780
  • Thank you received: 1258
  • Karma: 514
Oops, thanks for the catch vierundzwanzig.
Dear <span class="contactName">&nbsp</span><br />
<br />
Asset No <span class="assetNumber">&nbsp;</span><br />
Serial No. <span class="serialNumber">&nbsp;</span><br />
Customer Ref <span class="customerRef">&nbsp;</span><br />
Create Date <span class="createDate">&nbsp;</span><br />
Fault Description <span class="faultDescription">&nbsp;</span><br />
Solution <span class="solution">&nbsp;</span><br />
<br />
Call <span class="RequestID">&nbsp;</span> has been Resolved.
<script type="text/javascript" charset="utf-8">
 
	function getURLParameter(name) {
		return decodeURI(
			(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
		);
	}
 
	$(document).ready(function() {
		$('.contactName').text(getURLParameter('6X44X11'));
		$('.assetNumber').text(getURLParameter('6X44X22'));
		$('.serialNumber').text(getURLParameter('6X44X33'));
		$('.customerRef').text(getURLParameter('6X44X44'));
		$('.createDate').text(getURLParameter('6X44X55'));
		$('.faultDescription').text(getURLParameter('6X44X66'));
		$('.solution').text(getURLParameter('6X44X77'));
		$('.RequestID').text(getURLParameter('6X44X88'));
	});
 
</script>
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The administrator has disabled public write access.
The following user(s) said Thank You: rocksalt

Aw: Pre-population of questions..... 4 years 4 months ago #71345

  • rocksalt
  • rocksalt's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
Typically i'd have a LS questionnaire...

limesurvey.local/index.php?sid=17999&lang=en

then i would ( still have to investigate this bit ) tack on to the end the extra information to pre populate the fields..... im not sure if remedy can do this, this i have to figure out if it's dynamic enough to do.
If not, i thought maybe using a token... our remedy system uses a ref number like 1316379 so i could have that as a token, however, as a call is generated, acted upon and then closed... this is the part im going to have trouble with... linking that final act of a closure e-mail to LS in order for it to pick up the data and fill it out. the email the user gets, is already populated with the data i need to extract and use to pre populate the LS fields, but i can't see an obvious way to marry the two together.

Can LS run on like a cron job system? and automatically send invites based upon parsing a csv or txt file ? it seems a complicated approach though so might not bother with that.

I think i could probably convince the power that be that this is now going to have a manual element to the process in that the user must ( mandatory ) fill out name, call ref, location and phone number, but i think we'd see a drop in actual responses as the users would just not bother if it was perceived as time consuming.
vierundzwanzig wrote:
Hello,

sorry if I missunderstood but do you have an URL like
limesurvey.local/index.php?sid=17999&lang=en&6X44X11=ContactNameMain&6X44X22=AssetNo&6X44X33=SerialNo&6X44X44=CustomerReference&6X44X55=CreateDate&6X44X66=FaultDescription&6X44X77=Solution&6X44X88=RequestID
or do you have to create this URL yourself?

If you allready have this kind of URL you can use the sollution provided by tpartner, you don't have to get any information from the oracle database in LimeSurvey because you allready have the information in your URL parameters.

@tpartner:
There is a copy/paste error in your scripts
Customer Ref <span class="contactName">&nbsp;</span><br />
should be something like
Customer Ref <span class="customerRef">&nbsp;</span><br />
and
$('.contactName').text(getURLParameter('6X44X44'));
has to be changed to
$('.customerRef').text(getURLParameter('6X44X44'));
.

If you only need the information from the URL on the welcome page and you don't use the <a href='www.docs.limesurvey.org/tiki-index.php?p...tions+for+LimeSurvey'>SGQA</a> code to prefill an answer of question X you don't have to use the <a href='www.docs.limesurvey.org/tiki-index.php?p...tions+for+LimeSurvey'>SGQA</a>. You can used parameters that are easier/more easy to read. For example
limesurvey.local/index.php?sid=17999&lang=en&conName=ContactNameMain&assNo=AssetNo&serNo=SerialNo&cusRef=CustomerReference&creDa=CreateDate&desc=FaultDescription&sol=Solution&reqID=RequestID
and change it in both the HTML and Javascript code. But as said before it depends on what you want to do.
The administrator has disabled public write access.

Aw: Pre-population of questions..... 4 years 4 months ago #71346

  • rocksalt
  • rocksalt's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
i've done some testing and i can get two variables included in the auto mail

survey.local/csq_forms/form1.php?call_re...00001318529&name=Tom Parker


so the url they click to start the survey as above can indeed have SGQA used to parse the two fields from the url into the survey like:

limesurvey.local/index.php?sid=17999&lang=en&6X44X88=RequestID=000000001318529&6X44X11=ContactNameMain=Tom Parker

does that make sense ?
The administrator has disabled public write access.

Pre-population of questions..... 4 years 4 months ago #71347

  • TMSWhite
  • TMSWhite's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 758
  • Thank you received: 83
  • Karma: 37
rocksalt-

1.92 with Expression Manager is supposed to support those URL parameters, but I haven't had any test cases with which to confirm that yet.

Brainstorming, another option might be to use tokens and token attributes. If you have the ability to insert data into the token table attached to the survey, you could then use normal replacements functions (INSERTANS:SGQA in 1.91+, or Expression Manager's approach in 1.92) to customize your emails and survey. That would avoid the need to send potentially identifiable information in the URL GET string (since by passing the token alone, LimeSurvey would have access to the other attributes stored in the database).

In order to take that approach, you'd either need the ability to write to the token_SID table directly, or use an API.

LimeSurvey Gurus - do we have an API for writing to the tokens table like this?

/Tom
The administrator has disabled public write access.

Pre-population of questions..... 4 years 3 months ago #71361

  • rocksalt
  • rocksalt's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
i tried using the SCGA path...

limesurvey.local/index.php?sid=51679&51679X8X48XQ1=Y

simple yes no radio button choice.....

does not work...

tried with survey active, and is not anonymous...i think there's something else here, but seeing as this is my first attempts with a scga i probably have done something wrong somewhere
The administrator has disabled public write access.

Aw: Re: Pre-population of questions..... 4 years 3 months ago #71365

  • Steve
  • Steve's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 493
  • Thank you received: 46
  • Karma: 17
rocksalt wrote:
i tried using the SCGA path...

limesurvey.local/index.php?sid=51679&51679X8X48XQ1=Y

simple yes no radio button choice.....

does not work...

tried with survey active, and is not anonymous...i think there's something else here, but seeing as this is my first attempts with a scga i probably have done something wrong somewhere

If I remember correctly you can't use something like "51679X8X48XQ1" with SGQA for this type of question. You have to use the question "51679X8X48" and set the value with "=Y" so it should be "51679X8X48=Y".
Mit freundlichen Grüßen/Best regards,

Stefan Gohlke
LimeSurvey Team
The administrator has disabled public write access.

Aw: Re: Pre-population of questions..... 4 years 3 months ago #71366

  • rocksalt
  • rocksalt's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
tried that... well... again after you mentioned it...

I've been testing the logic of it thus:

limesurvey.local/index.php?sid=51679&51679X8X48XQ1=Y
limesurvey.local/index.php?sid=51679&51679X8X48=Y
limesurvey.local/index.php?sid=51679X8X48XQ1=Y
limesurvey.local/index.php?sid=51679&X8X48XQ1=Y
limesurvey.local/index.php?sid=51679&X8X48=Y

none of these seem to work...

just a thought... this survey has just one question.... would i need another ?

i just added another question to it, as a seperate question group... still nothing.
i've changed it from a yes/no to a short text field.... stopped, started the survey again... re-ran the question url... was expecting "y" to appear in the box.... changed it to "tom" expecting tom to appear in box... nothing.
The administrator has disabled public write access.

Aw: Re: Pre-population of questions..... 4 years 3 months ago #71367

  • rocksalt
  • rocksalt's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
i've been basing my testing on this:

Prefilling survey answers using the survey URL

Tested with: 1.80RC3

You can prefill answers to questions in your survey by passing the SGQA Identifier, and the answer, as a parameter of your survey URL. This feature will only work where the survey is commenced immediately upon entering the URL (so it won't work if you use CAPTCHA's to restrict access, or the registration page).

You'll need to ensure that the answer you pass is the correct format for the question you are attempting to prefill - for example - multiple option questions should contain a "Y" to check a box. List type questions need the correct answer code. To be certain which codes to pass, complete a survey manually with the prefilled answer(s) you want, and then export the results as question codes and answer codes(not full text). This will give you both the correct SGQA identifier (the name of the column), and the correct format for the answer.

Example:
http://www.myownd.../index.php?sid=1234&1234X43X123=Y

When the user gets to that question, the "Y" will be prefilled as the answer to question 123 in group 43 in survey 1234.


is this still current ?
The administrator has disabled public write access.

Aw: Re: Pre-population of questions..... 4 years 3 months ago #71368

  • rocksalt
  • rocksalt's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
interestingly...

when i set question one as mandatory and then enter the following

index.php?sid=51679&51679X8X48=Tom&51679X8X49=123456

it gives an error that i can't continue as Q1 is mandatory... but doesn't add anything to the question field so the &51679X8X48=Tom portion.... is not being parsed into the field.
The administrator has disabled public write access.

Aw: Re: Pre-population of questions..... 4 years 3 months ago #71369

  • rocksalt
  • rocksalt's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
and also this.. which is more current....

Identifier for Array <a href='www.docs.limesurvey.org/tiki-index.php?p...tions+for+LimeSurvey'>question types</a>

Since it is a array question the particular subquestion within the cell must be identified too. Add the subquestion code of the row without an X. For example: Survey has ID 1, Group has ID 6, Question has ID 12. The particular subquestion has code 'ber1'. Your identifier for this "Array" question answer would look like this:

1X6X12ber1


Identifier for Array (Text) or Array (Number) Questions

Since it is a combined array question the particular answer within the cell must be identified too. Add the subquestion code of the row without an X, then append the underscore char and finally add the subquestion code that indentifies the column. For example: Survey has ID 1, Group has ID 6, Question has ID 12. The particular subquestion has code 'ber1', and the column is identified by the subquestion with code 'lab1'
Your identifier for this "Array (Text)" question answer would look like this:

1X6X12ber1_lab1

Uses of the <a href='www.docs.limesurvey.org/tiki-index.php?p...tions+for+LimeSurvey'>SGQA</a> identifier

The <a href='www.docs.limesurvey.org/tiki-index.php?p...tions+for+LimeSurvey'>SGQA</a> identifier can be used to load the answers to previously saved questions into the question text of later questions. (See Adding a Question - Information from previous answers)

It can also be used in the query URL of a survey to "prefill" answers to a survey. eg: for <a href='www.docs.limesurvey.org/tiki-index.php?p...tions+for+LimeSurvey'>SGQA</a> 1X6X121ab1, your query URL could include "&1X6X121ab1=Y" to prefill that answer with a "Y". (See workarounds -> Prefilling survey answers using the survey URL)

The <a href='www.docs.limesurvey.org/tiki-index.php?p...tions+for+LimeSurvey'>SGQA</a> identifier is also the field name where the data for each question is stored in the database survey responses table.

Dynamically reference the SGQ identifier

Some people may find a need to reference a question dynamically. For instance, if you would like to hide the input text field of a short text answer. You can now do this (as of SVN build 9755) by using the {SGQ} identifier. LimeSurvey will replace the {SGQ} with the full Id of that question, ex: 3583X84X249
Contributors to this page: timbee , anonymous and admin .
Page last modified on Thursday 10 of February, 2011 19:44:51 CET by timbee.
Last Edit: 4 years 3 months ago by rocksalt.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 1.536 seconds