I want to get the current index of an item in an Array.
Use: I have an ItemType representing Signs on a Sign Post. A sign post can contain multiple signs, called an assembly. Each post has an AssemblyID (ie 1). Each sign has a SignID (ie A). So the individual signs will be labeled as 1A, 1B, 2A, 2B, 2C, etc...
Below is a simplified example: I have an ItemType with a Property Definition that is an array of Property Types.
I can see in the properties window that MSCE can access the index (Assembly[0] and Assembly[1]) but I can't seem to find any documentation or method to do this via ItemTypes.
In the above example, the SignID is just a picklist. What I want to do, is access the Index of the Array, and associate to a letter (ie 0 = A, 1 = B, etc).
I can access the total count of the array via the following expression: this.GetItem("DgnCustomItemTypes_TrafficTest:Signz")["Assembly"].count
I tried this randomly and it worked. I cannot seem to find documentation that the .count function exists. There is no context / tooltip / auto complete help on this. I have tried as many other options that I can think of, but i'm just stabbing around in the dark (ie .ID, .name, .index, .instance, etc...).
I've checked the list of examples (https://docs.bentley.com/LiveContent/web/MicroStation%20Help-v21/en/GUID-98C96A16-A9BD-4916-8233-4053B020596C.html) but that didn't help.
Does anyone know of a way to do this, or more importantly, know of a location where I can see all the functions/properties expressions as I'm sure there will be more instances of this.
Thanks.
Hi,
at first, please follow the best practices and specify both product and its exact version, preferably using standard subject format (like [MStn CE U16.1] Item type..). Items and related tools are developed and changed in different versions, so to know it can be important.
[MStn CE U16.1] Item type..
dkleinot said:I want to get the current index of an item in an Array.
I am not sure if I understand your question right, to share example DGN with an example would help a lot.
But I guess what you want is not possible: You can use an array index to access the array content (e.g. Assembly[1].SignID returns "D"), but it is not possible to ask for index of particular record. Or do you need something else?
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Hi,We currently don't have a way to get the current index using Item Type expression but I have created a Enhancement for it & we will try to make it available soon in the future update
Product Backlog Item 937911:
Answer Verified By: dkleinot