Can I use the same .vgrid file for multiple data files?

Use this forum to ask any questions and to submit bug reports

Moderator: vuser

Post Reply
vuser
Posts: 38
Joined: Sat May 01, 2010 8:11 pm

Can I use the same .vgrid file for multiple data files?

Post by vuser »

I love the GridLines feature but want to apply the same .vgrid file to multiple data files.

My data file names are in the form BS-{server-name}-{yyyymmdd}.dta.

Is there a way of using a single .vgrid file for each of these data files or does each data file need a corresponding .vgrid file?
FileViewer
Site Admin
Posts: 287
Joined: Fri Apr 30, 2010 5:50 pm

Re: Can I use the same .vgrid file for multiple data files?

Post by FileViewer »

Is there a way of using a single .vgrid file for each of these data files or does each data file need a corresponding .vgrid file?
Yes. You need to do the following:

Firstly, you need to enable Grid Rules - on the Options submenu of the main GridLines menu.

You then create a .rules file in the "Default Grid Directory". This file must be created manually with an editor.

Each line in this file (.rules) consists of a regular expression followed by a replacement string (separated by a "/").

When viewing a file, V will try to match the file name against each expression in .rules. If it finds a match, it tries to load the .vgrid file specified by the replacement.

If your file names were of the form BS-{server-name}-{yyyymmdd}.dta

you could apply a single .vgrid file by adding the following line to .rules:

Code: Select all

BS.*\.dta/BS.vgrid
This will cause V to load BS.vgrid for any file of the form BSxxxxx.dta.

Note that the expressions in .rules must be regular expressions - which are different from simple Windows/DOS wildcard expressions (like BS*.dta).

Also, any lines in .rules that begin with either # or ; are ignored (they can be used for comments).

Let me know if you have any problems.

Regards,
Charles.
Post Reply