Component Replace Multiple Parts in an Assembly from Vault

Component Replace Multiple Parts in an Assembly from Vault

hkeny
Explorer Explorer
142 Views
0 Replies
Message 1 of 1

Component Replace Multiple Parts in an Assembly from Vault

hkeny
Explorer
Explorer

Hi all, 

 

I have an assembly with multiple parts on my local folder. I have already dragged, dropped and assigned a meta data "Data A" to each individual part file onto Vault. I want help w a iLogic code to component replace each individual part file in my local assembly with the files that I have on vault.

 

For example, all part numbers in my local assembly match "Data A" to the files checked into Vault. 

 

I am able to write the code and replace for a single part file by creating a user parameter in my assembly which equates to "Data A" and search the file in vault that contains "Data A" and then replace a the required file with the file from Vault I just searched. But this is just as good as me replacing each file manually.

 

Any help to automate this?

 

This is what I am going off of. 

'Build one to many name/value pairs of Property/Value as search criteria;
Dim mSearchParams As New System.Collections.Generic.Dictionary(Of String, String) 'add UDP.DisplayName, Value Pairs
mSearchParams.Add("Data A", DataA)		'applies to file 001003.ipt
'...add as many as required to enable a unique search result

Dim mVaultFiles As List(Of String)
mVaultFiles = iLogicVault.CheckFilesExistBySearchCriteria(mSearchParams, False) 'returns file name(s)
If mVaultFiles.Count = 0 Then
	Logger.Error("The file(s) searched was(were) not found. Please double check that the search criteria's relevance.") 
	ModelName = "-"
	MessageBox.Show("Not found in Vault", "Status")
Else
	Dim mFileList As String
	For Each mFile As String In mVaultFiles
		mFileList += mFile & vbCr
	Next
	Logger.Info("iLogic-Vault file search found: " & mFileList)
	ModelName = mVaultFiles.FirstOrDefault
	MessageBox.Show("Found in Vault", "Status")

End If

mVaultFile = iLogicVault.GetFileBySearchCriteria(mSearchParams, True, False)
If mVaultFile Is Nothing Then
	Logger.Error("Check again")
	
Else
	Logger.Info("File" & mVaultFile & "found and downloaded")
	Component.Replace("11-C-6119-01_1453", mVaultFile, False)
End If

 

0 Likes
143 Views
0 Replies
Replies (0)