I understand from previous forum questions that non basic text should NOT be used for ITEMTYPE names, e.g. "-", "?" etc.
However, I have found an issue with prefixing names with numbers. While acceptable to Microstation and causes no errors in simple usage, an issue arises with Expressions.
e.g.
DATEType = Date/Time
SHORTDATEType=TextExpression = System.DateTime.GetDateOnly(this.DATE)
But, if DATE is renamed to 16DATE, the expression in SHORTDATE fails to parse.
FWIW. This does not fail if "DRAWDATE16" is used. So its not the fact that there is a number in the Property Definition, but the fact the number comes first..
NB. I have not trialled other Expressions for similar issues with number prefix Names.Also, placing the field in quotes e.g."16DATE" allows the field to parse, but it is not evaluated, so the Failure Value (if set) is the displayed result.
The primary purpose I have for prefixing with a number, is so that when the Instances are EXPORTED, I get the fields in the expected order in the resulting Excel file.Otherwise, without some ordering prefix (such as 01, 02, 03 etc.), because the export process sorts based on alphanumeric order, one ends up with a rather non-useful ordering if ITEMS, rather than the order in which the Names are shown in the ITEMTYPE definition, and in the Edit ITEMTYPES display.And yes, I have submitted an Idea request for this ordering.
Hi Gregory,
can you share DGN with such Item Types definition? It can speed up an analysis, instead of requiring readers to create own definitions to be tried.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Gregory Smith said:The primary purpose I have for prefixing with a number, is so that when the Instances are EXPORTED, I get the fields in the expected order in the resulting Excel file
By what mechanism do your Item Type data arrive in Excel?
Regards, Jon Summers LA Solutions
Gregory Smith said:I understand from previous forum questions that non basic text should NOT be used for ITEMTYPE names, e.g. "-", "?" etc.
Because Item Types are a subset of EC framework (EC XML), the naming rules are derived from this technology. And as its name says, it's "XML based", so Item Types naming rules are XML tags naming rules (see e.g. this page).
When a name, not following the rules, is entered, it's normalized to standard internal format. Usually it's enough to store all not standard characters as Unicode values, surrounded by __ (2 underscores).
Gregory Smith said:But, if DATE is renamed to 16DATE, the expression in SHORTDATE fails to parse.
Yes, it's "by definition" (and similar issues were discussed already).
16DATE is not valid XML name, because it begins with a number, which is not allowed. It means, it has to be normalized to __x0031__6DATE name. It's internal format, which is converted back from Unicode to normal strings automatically when it is displayed.
Gregory Smith said:but it is not evaluated, so the Failure Value (if set) is the displayed result.
Yes, because in fact, property named 16DATE does not exist.
I assume you should be able to see it in Editor (not sure whether Expression editor was available in U14), because Expressions work with internal names, not with display names:
Hi Jon
I use the EXPORT functionality provided with the ITEMTYPES command set (the far right command of the Ribbon, Content, Item Types, Import/Export)(I hope you don't mind my explaining further below, for others reading this to learn a bit of background use)
You have the option to export IT instances from your MODEL to Excel, which is useful for editing in an Excel environment and re-importing to update the instances in your MODEL
or
EXPORT the Definition to Excel, which includes all the Fields including Expressions, which is useful for 2 actions; backing up your IT Definitions in case they get changed or fail somehow (once changed, the elements that use them are forever altered) and to COPY an IT Definition from one file to another (if not defined in DGNLIB)
Greg Smith
Microstation 10.17.01.058
Opinions expressed are my own and not necessarily those of my employer
Hi Jan
Thank you for explaining the reason and how the linkages are with EC, and the link.I is quite annoying that Microstation allows these Names to be used without warning, then fail on certain actions.An error trap could well have been incorporated to control Names.I could not imagine an environment that does not allow free use of at least the basic ASCII characters, letters and numbers. FWIW I only have BASIC programming experience.I'll ensure letters only are used, but of course this persists the main issue I was trying to avoid, the unwanted sorting of Properties on EXPORT :( Hope my Idea is taken up by Bentley. ITEMTYPE Sorting Idea
I hadn't found a discussion that dealt with number prefixes though. Might have been alluded to though in the discussion on hyphens etc.
U14 does not include Expression Builder. I had to revert back from U15 as all our ITEMTYPES failed on opening U14 and earlier Picklists in U15 (Defect 1114952)