Have an idea?

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

Error #240 - Database error. Cannot update data row.

Here is more of the error:
Server Error: DBD::mysql::st execute failed: Data truncated for column 'AirportChoice_Var' at row 1 at C:/inetpub/vernonresearch_surveys/Airports/cgi-bin/authlib8_3_10.pl line 17, <GEN2> line 24.

I get this error when I click continue on a page that is supposed to run through a free format question for me to assign a value to a variable.  I have 5 other free format questions before this one, so it's not that I don't know how to write a free format question properly.  Also, I only get it when I am online in Test Mode, not when I test locally.  How are the two environments different such that this would happen?
asked Apr 9, 2015 by IowaResearcher (275 points)

1 Answer

0 votes
Something to keep in mind is that when run locally, SSI Web studies store their data in an SQLite database. It appears that on your remote server, however, the data is stored in a MySQL database. The syntax is mostly the same, but there are some differences.

I have, on occasion, found that the SQL statements I rely on in MySQL don't function in a SQLite environment. Are you writing any of your own SQL for this free format question?
answered Apr 9, 2015 by Jonathan Huff Bronze (1,575 points)
I'm just using perl.  Here's my exact code:

<input type="hidden" name="BizTest_Var" value="

[%

 Begin Unverified Perl

my $BIZpast = GETVALUE("TripsNum_r1_c1");
my $BIZfuture = GETVALUE("TripsNum_r2_c1");
my $PersonPast = GETVALUE("TripsNum_r1_c2");
my $PersonFuture = GETVALUE("TripsNum_r2_c2");

if (($BIZpast + $PersonPast)>0)
    {
    if ($BIZpast >= $PersonPast)
        {return "1";}
    }
elsif ($BIZfuture >= $PersonFuture)
    {return "1";}
else
    {return "0";}

End Unverified %]
">
I didn't think you were using any SQL with your Perl.  I'm not as familiar as I'd like with the working of SSI Web Perl stuff.
...