Page 1 of 1

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

Posted: Sun May 02, 2010 7:49 pm
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?

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

Posted: Sun May 02, 2010 9:11 pm
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.