Better understanding of MicroStation Variable construction.

MicroStation, Version 08.11.09.832

Two questions:

In the instructions under "Configuration Variable File Syntax" for every version of MicroStation I have used in years, there is a small section explaining how and when these brackets: ()

And these brackets: {} are used

I don't get very complex very often and so do not completely understand the difference circumstances under which these two should be used.


Second:

If I am trying to create a complex line in a config file, like the following:

%include $(_KIC_DISCIPLINE){_USTN_USERDESCR}.cfg level 2

I am trying to understand when the $ is used and when it is not needed.

I have seen some examples where it is used a couple times in a line, and some lines where it looked the same, but was only used once. In the above example, I'm not sure I would need one between the two sets of brackets (and relating to the other question, if the second set of brackets I am using is correct).

Thanks.

Parents
  • Hi,

    Unknown said:
    Two questions:

    It's highly recommended to ask for one (and only one) issue in a post. It also leads to more efficient discussion. To mix two questions is not good idea.

    Unknown said:
    I don't get very complex very often and so do not completely understand the difference circumstances under which these two should be used.

    In my opinion the difference between $() and ${} is clear, but I agree it does not provide a recommendation when what type of the definition should be used:

    • If a variable is defined as $(VARIABLEREF) in a configuration variable, the definition is stored in MicroStation memory in the same way (not modified or evaluated). It means if in VARIABLEREF another variable is used (e.g. MS_DWGSEED  : $(_USTN_SYSTEMROOT)seed/seed.dwg), it's evaluate every time the variable is used.
      This approach is flexible (if referenced variable changes, the variable is changed also) and in my opinion it should be used nearly always.
    • If a variable is defined as ${VARIABLEREF}, it's evaluated at first and the result value is stored in MicroStation memory. Consequently if any variable used in the definition changes, the final value will not change, because the definition is forgotten and only the result from the first evaluation is used.
      This definition style is "fixed" but also a bit faster (no evaluation every time is done) and is used for definitions that don't change during MicroStation session. If you will check MicroStation configuration files, the curly brackets are used rarely and only for "base variables" defining different MicroStation folders (e.g. _USTN_DATABASECFG = ${_USTN_DATABASE}${_USTN_DATABASENAME}.cfg). These folder are fixed (so no reason to reevaluate them) and also are referenced by many others variables (so there is some performance saving if they will be not reevaluated every time).

    My personal recommendation is to use $() style definition everywhere. Only if there is something very fixed (like definition of folders of e.g. installed application), it makes sense to use ${}.

    Unknown said:
    I am trying to understand when the $ is used and when it is not needed.

    Can you share some examples of places where $ sign is not used? I quickly check MicroStation configuration files and have not found any. But I did not spend too much time with this check ;-)

    MicroStation variable is always defined using $(), so if more variables should be merged together, it should look like this $()$().

    Where you can see variable names without $ sign is when operators are used, because these functions takes variable name (not final result) and make own variable processing. An example is WORKSETEXT = ext (_USTN_WORKSETCFG), which returns a file extension, so in this case ext() function will return probably .cfg as a result (example taken from CONNECT Edition, I think WORKSETEXT does not exist in V8i).

    I hope it helps a bit :-)

    With regards,

      Jan

  • Jan, would you mind explaining why "MicroStation variable is always defined using $()"? i,e. What is the significance of defining the variable using $ sign?

  • Hi Shila,

    it's recommended to do not re-open odl discussions, and this one is 5 years old. Usually it's better to ask in a new post.

    why "MicroStation variable is always defined using $()"?

    It's not always, only when a variable is defined using another variable.

    What is the significance of defining the variable using $ sign?

    How MicroStation configuration works and what is a syntax of configuration files is in detail described in MicroStation documentation, including how and when to use $( ), ${ } or to define the variable value directly.

    I also recommend to create msdebug.txt file and try to read it and understand the workflow, because it illustrates how variables are defined using another variables.

    With regards,

      Jan

    Answer Verified By: Marc Thomas 

Reply Children
No Data