Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Survey link expiry control

I have an ongoing project where sample is being added continually.

I would like to apply an expiry to the survey links so that after say 30 days, the survey link will no longer be active.

I need to take into account incompleted survey links as well as those survey links that have not been clicked on.

Is this possible without it being overly complicated?
asked May 4, 2017 by Paul Moon Platinum (97,120 points)
The first thought that comes to my mind would be to store respondent's expiration times in a merged field then use skips to lock them out if the current time is greater than the expiration time.  That would require a skip on every page in order to handle incompletes, though.
The actual survey is not too lengthy so it wouldn't be ridiculous.

Would you operate off a date field? Dates can be horrible when in amongst calculations? Or would you think a timestamp integer would be preferable?

Having many skips wouldn't be the ideal but it would be better than doing zilch.

Any other suggestions spring to mind?

1 Answer

0 votes
I would probably go with an integer just because it's cleaner than having to worry about timezones and date formats and such.  There are free online resources out there that will convert a human readable date into an epoch timestamp for you.  Then the skip logic would look like this:

Begin Unverified Perl
return time() > int(GETVALUE('expiration'));
End Unverified
answered May 4, 2017 by Zachary Platinum Sawtooth Software, Inc. (201,975 points)
I am assuming time and int are not  SSI Script functions.

What format is "expiration" in?
That's correct; "time" and "int" are Perl functions.  I set the merged field to text rather than whole number due to merged fields not being able to handle such enormous numbers.
When I deal with such big numbers from time stamps or system times, I generally minus a large number from the time variable to make it a smaller number, being careful not to affect the true value of course.
Clever.  Current epoch time is around one and a half billion.  If you subtract that from the merged field values, you could use whole number instead of text and use skip logic like:

Begin Unverified Perl
return time() - 1490000000 > GETVALUE('expiration');
End Unverified
Yes, that's the idea. Start dealing with smaller numbers by subtracting a large number without affecting the operation of comparing.
Where this also comes in handy ...

When you pass large whole numbers via pass-in fields from one Sawtooth Software survey to another, there is a limit on the size of that number. So when I was using a function like SystemTime() to pass, I would have to use this technique and subtract a largish number to allow the passing from A to B. It worked a treat and I was dealing with smaller manageable numbers.
I will be looking at this as the related project commences. I'll let you know how it goes. Thanks again.
...