DLIST2VDF challenges

Use this forum to post Vensim related questions.
Post Reply
rob_n
Senior Member
Posts: 53
Joined: Thu Feb 22, 2018 6:12 pm
Vensim version: DSS

DLIST2VDF challenges

Post by rob_n »

I have data in relational database form that I'd like to import into Vensim. The DLIST2VDF function looks perfect, but...

Working from the Vensim help
https://www.vensim.com/documentation/in ... st2vdf.htm

I made a tab-delimited file that looks like this:

variable region time value
asdfasdf US 1950 1
asdfasdf US 1960 2

I call the DLIST2VDF function with a .cmd file with one line:

MENU>DLIST2VDF|?datafile|

I open the .cmd file using File > Open Model > Command Scripts (*.cmd) then pick the tab delimited file.

I get the following warnings:

WARNING: No variable found on line 1: variable region time value.
Line 1 of file test.txt.
WARNING: No variable found on line 2: asdfasdf US 1950 1.
Line 2 of file test.txt.
WARNING: No variable found on line 3: asdfasdf US 1960 2.
Line 3 of file test.txt.
Encountered 3 warnings and 0 errors reading data
Writing 0 values for time base -Time

I can't see yet what I'm doing wrong? Any help would be appreciated!
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: DLIST2VDF challenges

Post by Administrator »

What happens if you remove the first line and try importing?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: DLIST2VDF challenges

Post by tomfid »

It turns out to be an easy fix. The algorithm that is supposed to guess the delimiter isn't working for some reason. If you rename the file to .tab, it knows what to do.
rob_n
Senior Member
Posts: 53
Joined: Thu Feb 22, 2018 6:12 pm
Vensim version: DSS

Re: DLIST2VDF challenges

Post by rob_n »

Works like a charm! Friendly suggestion, please add a note to the help file suggesting naming the file with .tab extension, until delimiter guess routine is fixed?
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: DLIST2VDF challenges

Post by tomfid »

Maybe delimiter guess is a dumb idea and should simply be deleted?
rob_n
Senior Member
Posts: 53
Joined: Thu Feb 22, 2018 6:12 pm
Vensim version: DSS

Re: DLIST2VDF challenges

Post by rob_n »

In a pinch, I can live with tab-delimited. But CSV files are very common.
Guessing the delimiter is a nice-to-have: it would be ok with me if delimiter was specified through one of the arguments to DLIST2VDF, e.g.

MENU>DLIST2VDF|?datafile||, for comma delimited
MENU>DLIST2VDF|?datafile||t for tab delimited, etc.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: DLIST2VDF challenges

Post by tomfid »

You can use csv now, if the extension is csv.
rob_n
Senior Member
Posts: 53
Joined: Thu Feb 22, 2018 6:12 pm
Vensim version: DSS

Re: DLIST2VDF challenges

Post by rob_n »

When I run the command script with the ?datafile argument (summoning a dialog bos allowing me to pick the data file for processing), the filter allows tab-delimited files only: files with .csv extension are not listed, and so cannot be selected :-(

Files with .txt extension do appear. When processing a .txt file that is in fact comma-delimited, I get the previous errors.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: DLIST2VDF challenges

Post by tomfid »

I think you'd have to give up the ?file wildcard and use filename.csv directly.
Post Reply