on 2020 Aug 13 8:38 PM
Hello,
I am currently working on program which search and open document from ECTR based on document number. How can I also retrieve document description in this code?
//Code
DocSearch docSearch = new DocSearch();
docSearch.DocNumber = "40000169574";
IPlmConnector connector = PlmConnectorFactory.GetPlmConnector(config);
IPlmResponse plmResponse =connector.SearchDocument(ListParts, docSearch, Com.Dscsag.Plm.Comm.SelectionMode.DEFAULT);
string strFileName = plmResponse.Parts[0].Filename;
string strDocumentDescription= ???
acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.Open(strFileName, false);
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument = acDoc;
Thank you for your time.
MD
Request clarification before answering.
Hello Mangesh,
The connector function "SearchDocument" does not retrieve any metadata about a document. The metadata can be read with the function "ProvideInfo".
Here is a small code example:
string partFileName = ....
IPlmRequestPart part = new
PlmRequestPartImpl(partFileName);
// read meta data from SAP to get description
PlmRequestPartList parts = new PlmRequestPartList();
parts.Add(part);
IPlmResponse response = connector.ProvideInfo(parts, true);
PlmResponsePartList provideInfoParts = response.Parts;
foreach (IPlmResponsePart responsePart in provideInfoParts)
{
PartInfo info = responsePart.PartInfo;
if (responsePart.Action == PartAction.DO_NOTHING && info != null)
{
logger.Trace("Results of Provide Info Process for: " + responsePart.Filename);
logger.Trace("Param: IS_OK: " + info.Ok);
if (info.Ok)
{
// trace description
string partDescription;
info.Metadata.TryGetValue("DESCRIPTION", out partDescription);
logger.Trace("Descripton: " + partDescription);
// trace all meta data
logger.Trace("MetaData...");
foreach (var entry in info.Metadata)
logger.Trace(" NAME: " + entry.Key + " VALUE:" + entry.Value);
}
}
}
Regards,
Gerhard
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
a quick follow up question on this. This retrieves the description as per my needs but I also noticed that some of the imported documents gets their description cut short like there is limitation on length. Please refer to the attached screenshot in which the document description is "This file is temporary test bed to verif" which is retrieved by using the code above. However, the original description is "This file is temporary test bed to verify working of PLM connector". Is there anyway to retrieve this description?
Hi MD,
description is only 40 characters long. The rest is stored in long text.
That's why you see only the first 40 characters and the rest is show in full length below in you screenshot.
Regards,
Gerhard
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the answer. I will try it out soon.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.