Custom Property File

Custom Property File

davdelomb
Contributor Contributor
480 Views
1 Reply
Message 1 of 2

Custom Property File

davdelomb
Contributor
Contributor

Hello,

 

I have a question about creating a custom property.

I want to create a property named: "MaxCode" (associations: File).

 

For the value of the property i want to get a part of the folder path where there drawing is located.

 

Like this:

 

Folder path: $/Drawings/_Demo/DMO/DMO-010 Test Property

File Property: MaxCode : DMO

 

I want to get the value in red out of the folder path and put it in the property "MaxCode"

the position of the value that i want is always in third position.

 

Is there a way to do this in vault?

 

0 Likes
Accepted solutions (1)
481 Views
1 Reply
Reply (1)
Message 2 of 2

Darin.Green
Mentor
Mentor
Accepted solution

No. You would need to use C#, VB or similar and use the split string function.

 

string Folder_path: "$/Drawings/_Demo/DMO/DMO-010 Test Property"; // Variable to store the folder path
var get_third_occurrence = Folder_path.Split('/')[3]; // This will split the folder path by / and return the value to the right of the 3rd occurrence.

 

or Substring...

 

var str"$/Drawings/_Demo/DMO/DMO-010 Test Property";

var char_to_split_by = str.IndexOf("/");
var get_third_occurrence = index < 0 ? str : str.Substring(3, char_to_split_by );

 

both of these examples will return:

DMO

 

I'm quite sure Vault doesn't have this functionality built-in to split a string (path) into parts...



If this information was helpful, please consider using the Accept Solution