|
ExtensionGetVariableFromDb Method
|
Gets the value of the vault variable for the specified file.
Namespace:
CADSharpTools.PDM
Assembly:
CADSharpTools.PDM (in CADSharpTools.PDM.dll) Version: 1.4.16.0 (1.4.16)
Syntax public static MethodReturn<Object> GetVariableFromDb(
this IEdmFile5 file,
string variable,
string configurationName = "@"
)
<ExtensionAttribute>
Public Shared Function GetVariableFromDb (
file As IEdmFile5,
variable As String,
Optional configurationName As String = "@"
) As MethodReturn(Of Object)
Parameters
- file
- Type: IEdmFile5
File object. - variable
- Type: SystemString
Vault variable name. - configurationName (Optional)
- Type: SystemString
Configuration name. Default is "@".
Return Value
Type:
MethodReturnObjectUsage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEdmFile5. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Exceptions Remarks Examples
This example shows how to login to the vault and get the value of a vault variable called "Part Number" for the first file.
public enum EdmLoginFlags
{
Nothing,
WebClient
}
public static void Example()
{
var swPDMVault = new EdmVault5();
var swPDMVaultEx = swPDMVault as IEdmVault13;
swPDMVaultEx.LoginEx("Admin", "****", "CADSharp LLC", (int)EdmLoginFlags.Nothing);
var swPDMRootFolder = swPDMVaultEx.RootFolder;
var swPDMFirstFilePos = swPDMRootFolder.GetFirstFilePosition();
if (swPDMFirstFilePos.IsNull == false)
{
var swPDMFirstFile = swPDMRootFolder.GetNextFile(swPDMFirstFilePos);
var variableReturn = swPDMFirstFile.GetVariableFromDb("Part Number");
if (variableReturn.IsError)
{
Debug.Print(variableReturn.Error);
return;
}
var partNumberValue = variableReturn.Value.ToString();
Debug.Print($"Part Number variable value: {partNumberValue}");
}
else
{
Debug.Print($"Vault has no files at the root folder.");
}
}
See Also