Check out the LimeSurvey source code on GitHub!

attribute fields in LS 1.90+

More
6 years 1 month ago #54050 by boykov
Hi.

I have been running LS 1.80+ for a long time. I use non-anonymous surveys and my system is heavily dependent on storing id-values in attribute_1 and attribute_2 fields.

I upgraded to 1.90+(9596) successfully. However, when I create a new survey and activate it in 1.90, the token table doesn't have attribute_1&2. Why?

I need to find a workaround asap. I added the missing fields manually, is this going to do the job? In which php-file is the method for creating the token-table? I also need to fix the spss-export to include those two fields (attribute_1&2).

Thanks in advance.

Please Log in to join the conversation.

More
6 years 1 month ago #54051 by mdekker
You can create as many additional attributes as you like in the new version. There is an icon for it in the token screen.

---
Menno Dekker

Please Log in to join the conversation.

More
6 years 1 month ago #54057 by boykov
Thank you.

My problem is that my process is very automated, and I can not go through the token screen every time I activate a survey. My problem was that the fields are not created by default. Now I have solved that with my own php-script which appends the fields to token-table if not exist.

About the spss-export, it seems like all attribute_ fields are detected dynamically and will be exported if they exist in the token-table, right?

Thank you.

Please Log in to join the conversation.

More
6 years 1 month ago #54063 by mdekker
Not really sure about the inner workings of the dynamic token fields, but if you run a test and they export then you are fine. If not, you have to search for another place to tell that the survey has a number of extra attribute fields. A bit too busy to check that for you. If you can report back here it would be helpful for others too.

---
Menno Dekker

Please Log in to join the conversation.

More
6 years 1 month ago - 6 years 4 weeks ago #54159 by boykov
Hi.
I have automated the attribute_ field creation in the following way:
$fields = mysql_list_fields($DB, $token_table_name);
$columns = mysql_num_fields($fields);
for ($i = 0; $i < $columns; $i++) {
$field_array[] = mysql_field_name($fields, $i);}
 
if (!in_array("attribute_1", $field_array)) {
	mysql_query("ALTER TABLE " . $token_table_name . " 
ADD attribute_1 varchar(100) default NULL;");
	}
if (!in_array("attribute_2", $field_array)) {
	mysql_query("ALTER TABLE " . $token_table_name . " 
ADD attribute_2 varchar(100) default NULL;");
	}

The SPSS function works just fine. It exports the extra token fields.

Hope this is helpful.
Last Edit: 6 years 4 weeks ago by boykov.

Please Log in to join the conversation.

More
6 years 1 month ago #54164 by Mazi
Thanks for your feedback.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form