Data input from MySQL database

Use this forum to post Vensim related questions.
Post Reply
Pruyn
Senior Member
Posts: 80
Joined: Fri Mar 05, 2004 2:34 pm

Data input from MySQL database

Post by Pruyn »

I'm having a small problem with the data retrieval from an MySQL database over an ODBC link.

When Vensim is compiling the Variable names, I get the following problem.

WARNING: There is no variable - Work Percentage Lookup[Yard1,Cabling,"
","
"] - in the current model.

Since not all my variables have the same amount of subscripts, MySQL reports a NULL in the empty spaces. My guess is that these are translated to " by Vensim.

The most obvious solution would be to put the subscripts also in the Varname column, but still I would like to keep these seperated. Hope someone can tell me another way around this problem

Jeroen
Pruyn
Senior Member
Posts: 80
Joined: Fri Mar 05, 2004 2:34 pm

Post by Pruyn »

I removed a (for now) empty column and the problem was fixed. Also for the variables with less subscripts. If it happens again I'll post it.

Jeroen
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

Just glancing at this it looks like MySQL is returning a carriage return on what should be an empty string. Why it would do something like that totally baffles me, but I have not worked with MySQL very much so anything is possible.

There may be a setting in the data definitions of MySQL setup that controls this. I will build in something to deflect this in future Vensim Revs, but there is no Vensim sided workaround I can think of right now.
Pruyn
Senior Member
Posts: 80
Joined: Fri Mar 05, 2004 2:34 pm

Post by Pruyn »

Found the problem.

I'm running MySQL under Windows. When I'm importing text-files, I need to ignore the line terminator, this is what bugged the vensim translation.

Thanks, Jeroen
Pruyn
Senior Member
Posts: 80
Joined: Fri Mar 05, 2004 2:34 pm

Post by Pruyn »

I have a new problem with the MySQL database communication. For a small model it is possible to change database values during simulation, while running vensim as a game reading the data over an ODBC connection.

In my larger model this also works for the first time step, but afterwards this ability is somehow lost. I have also created a Venapp program which orders the use of a .vdi script before running the next step, but this also doesn't work.

Does anyone have any suggestions for a solution, or an idea where the problem might originate.
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

I can't think of any reason that simple size would be causing problems, so I think it must relate to some feature of the model and database that is causing the problem.

Does you simple model have the same subscript character as the more complex model? If not add in additional subscripts on the inputs/outputs and see if it still works.
Pruyn
Senior Member
Posts: 80
Joined: Fri Mar 05, 2004 2:34 pm

Post by Pruyn »

Found the problem, had the same variables in two different tables. Vensim orders the input somewhat arbitrary, one variable as I described earlier, another only from the second table. This is actually how I found out.

Thanks.
Post Reply