Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Concatenate Vault Properties With DataStandard 2015

1 REPLY 1
SOLVED
Reply
Message 1 of 2
orbjeff
566 Views, 1 Reply

Concatenate Vault Properties With DataStandard 2015

 

I’m using the Vault DataStandard File.xaml form. I have three Vault properties which include:

 

  1. “Assy Glossary” – (ComboBox using picklist values from Vault)

    ItemsSource="{Binding Prop[Assy Glossary].ListValues}"

     

  2. “SecondaryDescription” – (Textbox)

    Text="{Binding Prop[Secondary Description].Value}"

     

  3. “Description”. (Textbox)

    Text="{Binding Prop[Description].Value}"

     

I need to concatenate “Assy Glossary” + “Secondary Description” and save the result to “Description”.

Each individual value for “Assy Glossary” and “Secondary Description” also needs to be saved back to vault in their respective Vault properties.

 

At this point I have already tried several solutions that include using the IValueConverter and IMultiValueConverter in my own custom class but using the XAML code below I can’t bind the result of the converter to the Vault property “Description”

 

<TextBox Name="descriptionHelper" Grid.Column="0" Grid.Row="4">
      <TextBox.Text>
         <MultiBinding Converter="{StaticResource stringConcatHelperConverter}">
           <Binding ElementName="assyGlossDesc" Path="Text" />
           <Binding ElementName="secondDesc" Path="Text" />
         </MultiBinding>
           </TextBox.Text>
</TextBox>

 

 

Is there any way to concatenate two vault properties and save the result to a third property, without implementing my own custom class and just using what has been provided within the context of the DataStandard framework?

Jeff Johnson
Technical Consultant
MasterGraphics Inc.
1 REPLY 1
Message 2 of 2
orbjeff
in reply to: orbjeff

I finally got this to work. I just didn’t realize how easy it was to apply what I already knew about the Vault API and C# to DataStandard and Powershell. Once I found the coolOrange blog and read through a few of their examples it all started to make sense.

 

Here is what I did. I welcome any feedback on how to improve this solution

 

Step 1: Edit the “Default.ps1” file and add the two new event handlers to the InitializeWindow function

 

Notice: Change the property names to match your property display names.

 

function InitializeWindow
{
	$dsWindow.Width = 650
	$dsWindow.Height = 625

	$Prop["15 Assy Glossary"].add_PropertyChanged({param( $parameter, $source) if($source.PropertyName -eq "Value") { Category_OnPropertyChanged }})
	$Prop["16 Secondary Description"].add_PropertyChanged({param( $parameter, $source) if($source.PropertyName -eq "Value") { AddDesc_OnPropertyChanged }})
	#if($dsWindow.Name -eq "FileWindow") { DWControls }
}

 

Step 2: Add the following event handler functions to the bottom of “Default.ps1”:

 

function Category_OnPropertyChanged
{
	$dsWindow.FindName("description").Content = $Prop['15 Assy Glossary'].Value + " " + $Prop['16 Secondary Description'].Value
}

function AddDesc_OnPropertyChanged
{
	$dsWindow.FindName("description").Content = $Prop['15 Assy Glossary'].Value + " " + $Prop['16 Secondary Description'].Value
}

 

 

Step 3: Add these three controls to your xaml file. In my case it was “file.xaml”

 

            <ComboBox Name="assyGlossDesc" ItemsSource="{Binding Prop[15 Assy Glossary].ListValues}" Text="{Binding Prop[15 Assy Glossary].Value}" IsEnabled="{Binding IsNewEntryDialog}" ></ComboBox>
            <TextBox Name="secondDesc" Text="{Binding Prop[16 Secondary Description].Value, UpdateSourceTrigger=PropertyChanged}" />
            <Label Name="description" Visibility="Hidden" Content="{Binding Prop[04 Description].Value}" />

 

 Thats it! I hope this helps others trying to do the same thing with DataStandard.

 

 

 

Jeff Johnson
Technical Consultant
MasterGraphics Inc.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report