cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrieve Attribute Values from a Workview Object

Derick_Geisend1
Champ in-the-making
Champ in-the-making

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)

2 ACCEPTED ANSWERS

Jeremy_Bartels2
Champ on-the-rise
Champ on-the-rise

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

View answer in original post

Not applicable

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;
     }
}

-------------------------------------

View answer in original post

3 REPLIES 3

Jeremy_Bartels2
Champ on-the-rise
Champ on-the-rise

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

Thanks Jeremy!

Not applicable

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;
     }
}

-------------------------------------