Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Autocomplete answer by csv

  • AntPIC
  • AntPIC's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
8 months 3 weeks ago #246105 by AntPIC
Autocomplete answer by csv was created by AntPIC
Please help us help you and fill where relevant:
Your LimeSurvey version: [see right hand bottom of your LimeSurvey admin screen]
Own server or LimeSurvey hosting:
Survey theme/template:
==================Hi, I would like to attach a csv to my survey. The goal is that if you choose a certain answer option in one of the previous questions, the next two will auto-fill, with the data contained in the csv.
Can you give me some pointers on this?
Thank you

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 months 3 weeks ago #246107 by Joffm
Replied by Joffm on topic Autocomplete answer by csv
Hi,
1. Please, do not double post at the same time. You also asked in the Italian part.
2. Why didn't you answer the questions at the beginning.
As your requirement is not doable by a built-in feature it is importent to know your version, where and how it is hosted to be able to advise.

And you should explain a bit more detailled.
Which type of question do you use in the "previous questions".
What is entered there?
And what is the structure if the csv?
How man entries are (more or less) in the csv?
Are these questions on the same page or not?
Always the best: Create a small prototype and send the lss export.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 months 3 weeks ago #246108 by tpartner
Replied by tpartner on topic Autocomplete answer by csv
A reasonable amount of coding knowledge would be required. You will need to load the CSV file via AJAX and parse it with something like jquery-csv - github.com/evanplaice/jquery-csv

Try searching the forums for "jquery-csv".

Cheers,
Tony Partner

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

Please Log in to join the conversation.

  • AntPIC
  • AntPIC's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
8 months 3 weeks ago #246119 by AntPIC
Replied by AntPIC on topic Autocomplete answer by csv
Thank you very much, here are more details for my survey.
- An application in which you choose between two institution type codes (present in the csv):
AX
AY
- Based on the choice of the two codes, the possibility opens to select the associated project codes (there are about 500) present in the csv
- Based on the choice of the project code, the following fields (present in the csv) should be autocompleted
project name
institution name

Possible?
P.S. I don't know how to use java codes

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 months 3 weeks ago - 8 months 3 weeks ago #246121 by Joffm
Replied by Joffm on topic Autocomplete answer by csv
Well, you still did not answer the questions about your version and the place where the installation is hosted.
You see, this is importent for us to know.
Otherwise we may propose solution that you can't use becaise of missing rights or a not compatible version.

And we have no idea how you want to display.
Here is what I understand:
As you say there are only about 500 project codes you can do this with only built in features.
This first (simple) solution is based on the assumption that the project codes are different in AX and AY
1. Enter the content of the csv-file into a question if type "long text"
Do this in a manner that each element has the same length, like
 
Here:
AX,AY: 2 characters
project number: 5 characters
project name: 30 characters
institution: 20 characters

2. In a question of type "list(radio) selct AX or AY
3. Use two dropdowns, one with the project codes of AX, one witjh the codes of AY
4. To display "project name" and "institution" create a question of type "multiple short text" and in the default answers enter this
project name
{if(Q1=="AX",trim(substr(eqPool,strpos(eqPool,Q2a.shown)+5,30)),trim(substr(eqPool,strpos(eqPool,Q2b.shown)+5,30)))}
institution
{if(Q1=="AX",trim(substr(eqPool,strpos(eqPool,Q2a.shown)+35,20)),trim(substr(eqPool,strpos(eqPool,Q2b.shown)+35,20)))}


If there can be the same project name in AX and AY you may add it tp the strpos-function, like
{if(Q1=="AX",trim(substr(eqPool,strpos(eqPool,"AX"+Q2a.shown)+7,30)),trim(substr(eqPool,strpos(eqPool,"AY"+Q2b.shown)+7,30)))}

 
 

Joffm

And as said before, you should provide a lss export of a prototype of this survey.

And you can read the csv file into the first "long text".
@tpartner mentioned the *ls file already.

Of course you can use a more sophisticated finction to capture the texts (if you do not want to restructure of the csv)
But as long as you do not show the structure of the file, ...?

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 8 months 3 weeks ago by Joffm.

Please Log in to join the conversation.

  • AntPIC
  • AntPIC's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
8 months 3 weeks ago #246127 by AntPIC
Replied by AntPIC on topic Autocomplete answer by csv
Thank you very much!
Mu version LimeSurvey Cloud
Versione 5.6.31

But how do I load the csv to extract the information?

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 months 3 weeks ago #246129 by Joffm
Replied by Joffm on topic Autocomplete answer by csv

But how do I load the csv to extract the information?

As@tpartner:
Try searching the forums for "jquery-csv".
This is mainly used to read in csv files for an "autocomplete" solution.
And read the small documentation about it 
[url] github.com/evanplaice/jquery-csv [/url]

Nothing else can be said, as long you do not give more information about the structure of the csv file.
Just give us an example wirh a few rows.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 months 3 weeks ago - 8 months 3 weeks ago #246130 by tpartner
Replied by tpartner on topic Autocomplete answer by csv
Also, attach a small sample survey (.lss file) containing only the relevant questions and a small sample CSV.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 8 months 3 weeks ago by tpartner.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose