GET DIRECT CONSTANTS('file','tab','cell') GET CONSTANTS DIRECTly from a file |
Scroll Prev Top Next More |
Returns a number, vector or 2-dimensional array of Constant values by reading from a delimited file. The number of values brought in is determined by the subscripts that are used in the left hand side.
Restrictions: Must appear directly following the equal sign = (or the == sign for Unchangeable Constants) and not be followed by anything else.
When a model is checked, GET DIRECT CONSTANTS opens the file to read the values. If no values are available, an error is reported. For normal Constants the values are also queried each time a simulation is made and a warning is given if the values are not obtainable. For Unchangeable Constants there is no query performed at simulation time. If a file is opened in Excel or another application Vensim may not be able to get values from it.
All of the arguments to GET DIRECT CONSTANTS must be Literals (enclosed in single quotes ') or String Variables. 'file' names a file with complete extension to read from (use '?Tag' to indirectly reference a file and resolve the reference in Model>Settings>XLS Files). This can be an Excel file (either .xls or .xlsx) or a delimited text file. If no directory is specified (best practice) Vensim will append directory information for the current model. 'tab' names the tab that contains the Constants or, for text files, the delimiting character (default is Tab except for .csv files). 'cell' names the cell that the first Constant value is on. Vensim will, as necessary, read additional cells to the right (on last subscript range) and down (on the second last subscript range) to get all values. You can force Vensim to transpose this reading by ending the ‘Cell’ name with a *.
NOTES
• | If the file is opened by another application Vensim may not be able to read it.. |
• | The constants read from this file will be overwritten if you make changes in setup mode or specify constant input (.cin) files. |
• | Changes to String Variables made in .cin files (or through Venapp commands) will not be used when determining file, tab or cell. |
• | If you have defined only Unchangeable Constants the file is not queried for simulations and providing a .vmf file or published model to someone without the associated file will not generate any messages. |
Units: GET DIRECT CONSTANTS is not part of units checking. Specify units for the left hand side variable.
Example
NOTE GET DIRECT CONSTANTS opens files directly and will not work if the file is already open in Excel.
Availability: Not PLE.
See also: GET XLS CONSTANTS, TABBED ARRAY
Sample model: GET DIRECT CONSTANTS.mdl and GET DIRECT CONSTANTS[ss].mdl in FunctionExamples