Output only new values through vdo

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

Output only new values through vdo

Post by Pruyn »

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]
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

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.
Post Reply