02-13-2018 06:27 AM
Having some trouble getting the value of an attribute. I'm sure it's something simple i'm missing...
Here's the code:
AttributeList attributeList = wvClass.Attributes;
if (attributeList == null) { throw new Exception("Could not get class attributes"); }
AttributeValueModifier atbModifier = obj.CreateAttributeValueModifier();
if (atbModifier == null) { throw new Exception("Could not create Attribute Modifier"); }
if (log >= 3) { diag.Write("test to verify attributes are being found"); }
foreach(Hyland.Unity.WorkView.Attribute a in attributeList)
{
if (log >= 3) { diag.Write(a.Name.ToString()); }
if (a.Name == "DisputeCaseClaimNumber")
{
// GET VALUE HERE
AttributeValue av = a.????
}
}
if (log >= 3) { diag.Write("loop through attribute list to build SQL"); }
if (log >= 3) { diag.Write("Claim #: " + attributeList.Find("DisputeCaseClaimNumber").ToString()); }
if (attributeList.Find("DisputeCaseClaimNumber").ToString() != "") //This should check the value either by object or setting it to a string above
{
if (log >= 3) { diag.Write("Claim # atrribute is not an empty string;"); }
string strClaimNum = attributeList.Find("DisputeCaseClaimNumber").ToString();
//MORE CODE BELOW (builds a SQL query to another system using the claim number above)
02-13-2018 07:02 AM
Derick,
You will need to use the "AttributeValues" class to get the value. Below is an example.
Hyland.Unity.WorkView.AttributeValue av = obj.AttributeValues.Find("DisputeCaseClaimNumber");
Jeremy
02-13-2018 07:14 AM
Try this out. It's simpler than you think. Unity API makes things much easier than the old VB Automation API where you would loop through collections just to find a match 🙂
--------------------------------------
var attValue = obj.AttributeValues.Find("DisputeCaseClaimNumber"); // I'm going to assume your attrib name is correct...if you wanted to test for that you could by checking for null
if(attValue.HasValue)
{
if(log >= 3)
{
diag.Write("Claim #: " + attValue.AlphanumericValue);
string strClaimNum = attValue.AlphanumericValue;
}
}
-------------------------------------
02-13-2018 07:02 AM
Derick,
You will need to use the "AttributeValues" class to get the value. Below is an example.
Hyland.Unity.WorkView.AttributeValue av = obj.AttributeValues.Find("DisputeCaseClaimNumber");
Jeremy
02-13-2018 07:24 AM
02-13-2018 07:14 AM
Try this out. It's simpler than you think. Unity API makes things much easier than the old VB Automation API where you would loop through collections just to find a match 🙂
--------------------------------------
var attValue = obj.AttributeValues.Find("DisputeCaseClaimNumber"); // I'm going to assume your attrib name is correct...if you wanted to test for that you could by checking for null
if(attValue.HasValue)
{
if(log >= 3)
{
diag.Write("Claim #: " + attValue.AlphanumericValue);
string strClaimNum = attValue.AlphanumericValue;
}
}
-------------------------------------
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.