I'm using vensim as for a gaming model. In this role I use a vdo-script to output some data from the model, each time step.
Until now I used delete and insert for this, but there is a lot of output and logically the output will increase with each game step taken as the whole time serie is outputted each time.
I was wondering if the UPDATE command could be used in combination with the model time, to update the database. The sql line would be something like:
UPDATE table_x SET table_x.value = (value of variable in varlist from VDO-script) where table_x.varid = (id variable in varlist from VDO-script) and table_x.time = time(vensim value)
This way only the values from the last time step will be outputted.
Jeroen
[Edited on 21-4-2005 by Pruyn]
Output only new values through vdo
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
Inserting data will always insert everyithing. You can inser constant and leave Time= blank to get the last time - but I don't see a way to communicate to the databse what that time is for a FIELD statement, though you could probably do it using triggers inside the database if you know that there is never any backing up. Be warned though, that a value at the current time might change is a gaming input that is used to compute it is changed. PRobably safest to live with the extra writes.