<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communities.bentley.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Named Expressions - Want to Show and Hide Menus Based upon Starting Characters of Active File Name</title><link>https://communities.bentley.com/products/administration/f/product-administration-forum/93817/named-expressions---want-to-show-and-hide-menus-based-upon-starting-characters-of-active-file-name</link><description>We use a DOT provided workspace which uses VBA to load various Barmenu files. The Macro reads the file name and grabs the initial three characters and loads the MDF files based upon what it finds. 
 I would like to migrate that to named expressions with</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Named Expressions - Want to Show and Hide Menus Based upon Starting Characters of Active File Name</title><link>https://communities.bentley.com/thread/283604?ContentTypeID=1</link><pubDate>Tue, 06 May 2014 11:34:16 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:68e4e020-eeb3-482a-bbf8-fd9c7aba1dfc</guid><dc:creator>Marc Thomas</dc:creator><description>&lt;p&gt;To hide the ABD specific tools&amp;nbsp;I needed a named expression that would test for the presence of ABD. ABD has it&amp;#39;s own set of Named Expressions that do not exist in MicroStation They included:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;BD_IsAppLoadedArch&lt;/li&gt;
&lt;li&gt;BD_IsAppLoadedElec&lt;/li&gt;
&lt;li&gt;BD_IsAppLoadedMech&lt;/li&gt;
&lt;li&gt;BD_IsAppLoadedStr&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;that check which of the four disciplines is loaded.&lt;/p&gt;
&lt;p&gt;I wanted one that would show my menu items when any of the disciplines were loaded so created a new named expression that included the expressions from all four of the above.&lt;/p&gt;
&lt;p&gt;The new expression is stored in the dgnlib that contains the menu so it travels with the menu.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Named Expressions - Want to Show and Hide Menus Based upon Starting Characters of Active File Name</title><link>https://communities.bentley.com/thread/283602?ContentTypeID=1</link><pubDate>Tue, 06 May 2014 11:17:47 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:456b1c88-9e88-498f-9dcf-4d297c800f58</guid><dc:creator>caddcop</dc:creator><description>&lt;p&gt;What exactly does this mean?&lt;/p&gt;
&lt;p&gt;[quote user=&amp;quot;Marc Thomas&amp;quot;]&lt;/p&gt;
&lt;p&gt;There are BD_IsAppLoaded... expressions for individual disciplines so I copied:&lt;/p&gt;
&lt;p style="margin-left:30px;"&gt;&lt;strong&gt;BD_IsAppLoadedArch&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;to:&lt;/p&gt;
&lt;p style="margin-left:30px;"&gt;&lt;strong&gt;Local_BD_IsAppLoadedABD&lt;/strong&gt; (in the dgnlib)&lt;/p&gt;
&lt;p&gt;[/quote]&lt;/p&gt;
&lt;p&gt;And how or why is it needed?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Named Expressions - Want to Show and Hide Menus Based upon Starting Characters of Active File Name</title><link>https://communities.bentley.com/thread/271841?ContentTypeID=1</link><pubDate>Tue, 14 Jan 2014 15:20:56 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:217eb969-1fca-4ba0-8c43-551660fad784</guid><dc:creator>Marc Thomas</dc:creator><description>&lt;p&gt;Another example:&lt;/p&gt;
&lt;p&gt;I have a custom menu that includes some AECOsim tools that I don&amp;#39;t want to see when I use the menu in either ABD&amp;#39;s MicroStation Mode or vanilla MicroStation.&lt;/p&gt;
&lt;p&gt;ABD has a whole set of Named Expressions prefixed BD_. They don&amp;#39;t appear in MicroStation mode so the first point&amp;nbsp;to note&amp;nbsp;is that the BD_ named expression that I need must be copied into the dgnlib containing the menu so it is always available.&lt;/p&gt;
&lt;p&gt;The expesssion I need isn&amp;#39;t quite there. I only want to see the menu when the Building applications are loaded.&lt;/p&gt;
&lt;p&gt;There are BD_IsAppLoaded... expressions for individual disciplines so I copied:&lt;/p&gt;
&lt;p style="margin-left:30px;"&gt;&lt;strong&gt;BD_IsAppLoadedArch&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;to:&lt;/p&gt;
&lt;p style="margin-left:30px;"&gt;&lt;strong&gt;Local_BD_IsAppLoadedABD&lt;/strong&gt; (in the dgnlib)&lt;/p&gt;
&lt;p&gt;BD_IsAppLoadedArch contains the Expression:&lt;/p&gt;
&lt;p style="margin-left:30px;"&gt;Session.EvalCExprAsInt(&amp;quot;BDesignerSettings.isAtfLoaded&amp;quot;, &amp;quot;DESIGNER&amp;quot;)=1&lt;/p&gt;
&lt;p&gt;By adding the similar expression for the other three diciplines with OR statements I get:&lt;/p&gt;
&lt;p style="margin-left:30px;"&gt;Session.EvalCExprAsInt(&amp;quot;BDesignerSettings.isAtfLoaded&amp;quot;, &amp;quot;DESIGNER&amp;quot;)=1&lt;br /&gt;OR&lt;br /&gt;Session.EvalCExprAsInt(&amp;quot;BDesignerSettings.isEtfLoaded&amp;quot;, &amp;quot;DESIGNER&amp;quot;)=1&lt;br /&gt;OR&lt;br /&gt;Session.EvalCExprAsInt(&amp;quot;BDesignerSettings.isHtfLoaded&amp;quot;, &amp;quot;DESIGNER&amp;quot;)=1&lt;br /&gt;OR&lt;br /&gt;Session.EvalCExprAsInt(&amp;quot;BDesignerSettings.isStfLoaded&amp;quot;, &amp;quot;DESIGNER&amp;quot;)=1&lt;/p&gt;
&lt;p&gt;This expression is the Show/Hide Test for each of the menu items. If the result of any one of these is True then the menu item is shown.&lt;/p&gt;
&lt;p&gt;They take a bit of getting used to but are very handy once you do.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Named Expressions - Want to Show and Hide Menus Based upon Starting Characters of Active File Name</title><link>https://communities.bentley.com/thread/271703?ContentTypeID=1</link><pubDate>Mon, 13 Jan 2014 19:37:58 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:404fe0c4-708e-4d01-becf-9b7ac27fafa1</guid><dc:creator>Jan Šlegr</dc:creator><description>&lt;p&gt;Hi caddcop,&lt;/p&gt;
&lt;p&gt;[quote user=&amp;quot;caddcop&amp;quot;]Sometimes, us &amp;quot;old dogs&amp;quot; find it hard to find the time to learn new tricks.[/quote]&lt;/p&gt;
&lt;p&gt;Tell me about it :-)))&lt;/p&gt;
&lt;p&gt;I remember I delved into Named Expression some time ago mainly because a user asked me for help and at the same time I was interested how this system can be extended with own Symbol Sets.&lt;/p&gt;
&lt;p&gt;[quote user=&amp;quot;caddcop&amp;quot;]or even learning them until the client decides how they want it used.[/quote]&lt;/p&gt;
&lt;p&gt;That&amp;#39;s true for sure.&lt;/p&gt;
&lt;p&gt;Named Expressions look a bit weird for the first sight, but if you understand one, you will probably be able to understand all. An important thing is to know what different Symbol Set do, so I recommend to spend a few minutes with Symbols Report (dialog Named Expressions, menu Utilities &amp;gt; Report Symbols). Another good source of information are Named Expressions delivered with MicroStation dgnlib, because they are widely used in MicroStation GUI (typically they drive local context mouse menu), as you can see in Workspace &amp;gt; Customize dialog.&lt;/p&gt;
&lt;p&gt;To control MicroStation GUI is the most important and probably the most straightforward usage of Named Expressions. But don&amp;#39;t forget it&amp;#39;s possible to create &lt;a target="_blank" href="http://www.labtech.cz/xwiki/bin/view/Projects/Symbol+Library"&gt;own Symbol Sets&lt;/a&gt; with own functionality.&lt;/p&gt;
&lt;p&gt;Crossing my fingers,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Named Expressions - Want to Show and Hide Menus Based upon Starting Characters of Active File Name</title><link>https://communities.bentley.com/thread/271659?ContentTypeID=1</link><pubDate>Mon, 13 Jan 2014 15:23:37 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:03ad6f4f-d660-498a-88bb-74b28598d732</guid><dc:creator>caddcop</dc:creator><description>&lt;p&gt;Thanks, Jan.&lt;/p&gt;
&lt;p&gt;Sometimes, us &amp;quot;old dogs&amp;quot; find it hard to find the time to learn new tricks. Bentley keeps adding capabilities but often we are tied to a client version or standard and if they are not using the newer capabilities, its hard to justify working on them or with them or even learning them until the client decides how they want it used.&lt;/p&gt;
&lt;p&gt;You info is concise and clear and not only gives me encouraging news but also those basic first steps.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Named Expressions - Want to Show and Hide Menus Based upon Starting Characters of Active File Name</title><link>https://communities.bentley.com/thread/271536?ContentTypeID=1</link><pubDate>Sat, 11 Jan 2014 05:59:41 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:fd22929e-2b98-4913-8f9a-7d1422cb4050</guid><dc:creator>Jan Šlegr</dc:creator><description>&lt;p&gt;Hi caddcop,&lt;/p&gt;
&lt;p&gt;welcome in Named Expression adventure! ;-)&lt;/p&gt;
&lt;p&gt;The Named Expression with the required functionality is &lt;span style="font-family:courier new,courier;"&gt;&lt;strong&gt;System.String.CompareI(System.String.Substring(System.Path.GetFileName(ActiveFile.FileName),0,3),&amp;quot;AAA&amp;quot;)&lt;/strong&gt;&lt;/span&gt;, where &amp;quot;AAA&amp;quot; is 3 chars long tested string.&lt;/p&gt;
&lt;p&gt;Because as you told you have just begun with the expression, here is the functionality explanation, going from inside to outside:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ActiveFile.FileName&lt;/strong&gt; - Returns a full name of the active file including path.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;System.Path.GetFileName(path)&lt;/strong&gt; - Extracts only file name including extension from the full file name. In this case, from e.g. c:\myfiles\mydrawing.dgn you will receive mydrawing.dgn.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;System.String.Substring (value,startIndex,length)&lt;/strong&gt; - Extracts only specified substring (from startIndex) from input string (defined in value). In this case, it takes short file name (mydrawing.dgn) and extracts 3 chars long string from the beginning (the index is zero-based, so 0 means the first char).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;System.String.CompareI (string1,string2)&lt;/strong&gt; - It does case insensitive comparison of two strings. If they match, true is returned, otherwise false. I use case insensitive comparison, because it&amp;#39;s usually not important if the file name is mydrawing.dgn or MyDrawing.dgn. If you want to use case sensitive comparison, use System.String.Compare (without I at the end).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Attached is captured Named Expressions dialog, don&amp;#39;t forget to check User interface keyword, so the expression will be displayed as available test in Customize dialog.&lt;/p&gt;
&lt;p&gt;With regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description><enclosure url="https://communities.bentley.com/cfs-file/__key/telligent-evolution-components-attachments/00-343321-01-00-00-27-15-36/Named-Expression-definition.jpg" length="185059" type="image/jpeg" /></item></channel></rss>