Data Standard: How to Populate a property with Filename?

Data Standard: How to Populate a property with Filename?

ryan
Collaborator Collaborator
1,134 Views
4 Replies
Message 1 of 5

Data Standard: How to Populate a property with Filename?

ryan
Collaborator
Collaborator

I am customizing Data Standard for a customer but have run into a small issue.   When a file is created using the "New Standard File" command, whatever the resultant filename is, I want to immediately populate a vault property (Stock Number) with the filename minus the extension.  

 

For example, you click New Standard File, specify your template and select the vault number scheme you want to use.  Once OK is selected, the vault generates your file (E00-1234.dwg) but I also want to populate the vault property called Stock Number with E00-1234.  Refer to attached screenshot.

 

Much thanks!

 

-Ryan

 

filename - new standard file.png

Ryan Small
National Team Leader, Data Management and Software Development
SolidCAD, a Cansel Company (an Autodesk Platinum Partner)
www.solidcad.ca
0 Likes
Accepted solutions (2)
1,135 Views
4 Replies
Replies (4)
Message 2 of 5

wangdu
Collaborator
Collaborator
Accepted solution

Hi Ryan,

 

For all things to achieve after OK button is clicked, the GetNewFileName function in the Default.ps1 file is the right place. 

 

In that function, all you need to do is set the property's value to the desired value. e.g.

 

$Prop["Stock Number"].Value = $Prop["_GeneratedNumber"].Value

Hope it helps!

 

Regards,

Wangdu

 

coolOrange

www.coolOrange.com

 

0 Likes
Message 3 of 5

ryan
Collaborator
Collaborator

Thanks for your help, that is almost perfect.

 

Would it be possible to have the Stock Number property pre-populated with the text "Will be generated"?  At present, the Stock Number value is required so the user currently has to type something in just to allow them to click the Ok button, even though upon doing so, whatever entered is getting replaced courtesy of the code you previously supplied on this thread.

 

I know in vaults configuration (Tools > Administration > Vault Settings >  Properties) I could set the Initial Value of the property; however, I would rather leave it blank and have the "Will ge generated" text pre-populated on the DS side.  I should note, I was able to do this easily on the CAD side of the customization by adding IntialValue="Will be generated" for the Stock Number property in the AutoCAD.cfg file but can't figure out how to do the equivalent in Vault.


Thanks so much!

 

-Ryan

Ryan Small
National Team Leader, Data Management and Software Development
SolidCAD, a Cansel Company (an Autodesk Platinum Partner)
www.solidcad.ca
0 Likes
Message 4 of 5

wangdu
Collaborator
Collaborator
Accepted solution

Hi Ryan,

 

There are couple ways to achieve this.

 

You could do this in the InitializeWindow function of the Default.ps1 file by setting "Will be generated" value directly to the $Prop["Stock Number"].Value. But you have to figure out well what should happen during the edit operation. 

 

Another way is to hide the Stock Number property from the dynamic properties grid. Once this property is not displayed the OK button should be enabled to carry on with the creation. This will work well except you don't see the property field anymore. For hiding a property, you should give a look at the VaultDynamicProperties.xml under the C:\ProgramData\Autodesk\Vault 2017\Extensions\DataStandard\Vault\Configuration. 

 

Hope it helps!

 

Wangdu

 

coolOrange

www.coolOrange.com

0 Likes
Message 5 of 5

ryan
Collaborator
Collaborator
Thanks again for your help, I was able to accomplish what I needed!

Ryan Small, Technical Specialist
1.877.438.2231 x110
2300 Steeles Ave West, Suite 240, Vaughan, ON L4K 5X6
[[image]]
Ryan Small
National Team Leader, Data Management and Software Development
SolidCAD, a Cansel Company (an Autodesk Platinum Partner)
www.solidcad.ca
0 Likes