Is there any way to automatically generate tokens? I mean, I have to imagine since there is a button to generate tokens there should be a way to call that function on the back end without having to physically press it with the mouse. Is this possible?
I guess I should have provided more info. I'm using 1 survey for customer satisfaction. I'm importing info into the tokens table from my company's completed orders database. I want limesurvey to create the tokens for those imports rather than me writing an rng for it. So i guess any way that I can automate that portion would be awesome. Full disclosure though: I don't know how to utilize an API. I'm not a programmer so this is new ground for me.
Can the add_participants remote control add _only_ the token to the table? I'm only looking for the unique id to be generated similarly to the 'generate tokens' button under token management.
How are you adding the tokens to the survey table? I'm using Limesurvey for a customer satisfaction survey too, and though I am not a professional programmer I did manage to write a bit of php code that takes our phone call log and directly generates invitations, along with a generated "token" (for me, each customer has an "account" number which I scramble a little bit) by putting entries directly into the mysql table. It wouldn't take much php code to generate a random number that could be used as a token.
If you're importing a .csv file, then at the bare minimum you're importing a file with three headers. It would be relatively trivial to open up the .csv file in excel and add a column titled "tokens" and use RANDBETWEEN(X,Y) to generate random numbers for all of the entries. Then save this new .csv file and use that instead.
I have no idea what LDAP is so I can't advise there.
Well before I explain that, it would help to know how we're using Limesurvey. We're a Franchisor. Our franchisees purchase equipment from us. Every time they purchase equipment, they will fill out a short satisfaction survey. It's always the same survey.
I created a stored procedure in MS SQL 2008 R2 to pull some basic info about the franchisee's order into my survey's token table. The part about crypt_gen_random(10) as token gives me a value which is then converted for use as the actual token value. I then fire off all order survey emails. This occurs daily. I don't necessarily like this method (of generating the tokens) as I feel the limesurvey software does it better.
Warning: Spoiler!
Code:
Insert INTO [Limesurvey].[dbo].[tokens_table]
([Limesurvey].[dbo].[tokens_table].firstname,
[Limesurvey].[dbo].[tokens_table].token,
[Limesurvey].[dbo].[tokens_table].email,
[Limesurvey].[dbo].[tokens_table].emailstatus,
[Limesurvey].[dbo].[tokens_table].language,
[Limesurvey].[dbo].[tokens_table].remindersent,
[Limesurvey].[dbo].[tokens_table].attribute_1,
[Limesurvey].[dbo].[tokens_table].attribute_2)
select
location,
cast( '' as xml ).value('xs:base64Binary(sql:column( "token" ) )', 'nvarchar(MAX)' ),
email,
emailstatus,
[language],
remindersent,
attribute_1,
attribute_2
from
(
select
RTRIM([[Closed_Orders_For_Survey].[Franchise Location]) location,
crypt_gen_random(10) as token,
[Closed_Orders_For_Survey].[Email] email,
'OK' emailstatus,
'en' [language],
'N' remindersent,
[[Closed_Orders_For_Survey].[Order Number] attribute_1,
CONVERT(VARCHAR(10), [[Closed_Orders_For_Survey].[Invoice Date],110) attribute_2
from
[[Closed_Orders_For_Survey]
where
[[Closed_Orders_For_Survey].[Order Date] >= dateadd(DAY, -1, Convert(date, GETDATE()))
) as x
END