Hi,
I am currently trying to export itmes with their BOMs via the Vault API, the export should be a .csv or be in a own SQL database. Any ideas how i should do that ?
I dont have alot of experience with this Vault API.
Greets from Italy
Solved! Go to Solution.
Solved by Redmond.D. Go to Solution.
The Vault client has an export command which allows you to export the BOM to a .csv. You want to perform that operation at the API level, correct?
The PackageService is what you want to use. Here is the basic list of functions:
Here is some old code I was able to dig up. It should still work in Vault 2013.
PkgItemsAndBOM pkgBom = packageSvc.GetItemsAndBOMsFromItemIds(
new long[] { item.Id });
MapPair levelPair = new MapPair();
levelPair.ToID = 0;
levelPair.ToName = "Level";
levelPair.FromID = -1000;
MapPair numberPair = new MapPair();
numberPair.ToID = 1;
numberPair.ToName = "Number";
numberPair.FromID = -60;
MapPair typePair = new MapPair();
typePair.ToID = 2;
typePair.ToName = "Type";
typePair.FromID = -62;
byte[] contents;
packageSvc.DownloadPackage(pkgBom.PkgItemArray, pkgBom.PkgBOM, FileFormat.CSV_LEVEL, new MapPair[] { levelPair, numberPair, typePair }, out contents);
Yea,
that is more or less the same solution i found also. But my next problem seems abit more tricky.
Is it possible to add by yourself over the importfunction of the packageservice to add the detailID ?
I think that wont work with a lot of trouble.
And how do i get all propertydefinitions from the items ?
So it sounds like you want to use import to set the Detail ID. I don't believe you can do that with the import feature.
Hey,
when the file is create, where is it then.
i cannot find it local and also not in the vault space?
i have Vault 2015
thx for help
Mario
Hey,
i guess you use the function mentioned above: packageSvc.DownloadPackage(..., out content) .
The file gets created and written as byte Array. In this case its written to the variable called "content", so its currently only in the memory.
You can create the file and save it to your hard disk by using a FileWriter.
System.IO.File.WriteAllBytes("Package.csv", content);
hope it helps
Hello @Redmond.D
I'm trying to use the "ToID" on MapPair (as said in the SDK 2019 docs) but it seems not to work at all.
ID value | Meaning |
-510 | Owner Name |
-520 | File Name |
-530 | Quantity |
-540 | Detail ID |
-1000 | BOM Indicator (Level) |
-1001 | BOM Structure (Parent) |
Using this, won't work:
$MapInfo[0].ToID = 0
$MapInfo[0].ToName = "Level"
$MapInfo[0].FromID = -1000
In the other hand, I found a post that uses this kind of property mapping , and this one works
$MapInfo[0].ToID = 0
$MapInfo[0].FromName = "BOMIndicator-41FF056B-8EEF-47E2-8F9E-490BC0C52C71"
$MapInfo[0].ToName = "LEVEL"
Am I doing something wrong?
Where can I find the equivalent for "BOMIndicator-41FF056B-8EEF-47E2-8F9E-490BC0C52C71" but for PARENT ??
Many thanks in advance
Regards
Sorry, ignore this part:
"Where can I find the equivalent for "BOMIndicator-41FF056B-8EEF-47E2-8F9E-490BC0C52C71" but for PARENT ??"