cancel
Showing results for 
Search instead for 
Did you mean: 

How i Can add a new record in a Keyword data set?

Alejandro_Contr
Champ in-the-making
Champ in-the-making

I need to add a new option with the API to a existing keyword data set, how i could do it, i have see in the SDK that i could use the next code for watch the actual values for the data set, but the question is... how i could add a new value to the data set.

//Retrieve the appropriate Keyword Type
KeywordType searchKeywordType = core.KeywordTypes.Find("Employee ID");

if (searchKeywordType == null)
{

Console.WriteLine("Employee ID keyword type was not found");
}


else
{
      //Get the Keyword Data Set for the Keyword Type
       KeywordDataSet keyworddataSet = searchKeywordType.GetKeywordDataSet();

     
 //Loop through the KeywordDataSetItem objects in the KeywordDataSet
       foreach (KeywordDataSetItem keyworddataSetItem in keyworddataSet)
       {
            switch (keywordDataSetItem.KeywordType.DataType)
            {
                    case KeywordDataType.AlphaNumeric:
                        string strValue = keywordDataSetItem.AlphaNumericValue;                  
                      // use value here

                        break;
                    case KeywordDataType.Numeric9:
                        long lngValue = keywordDataSetItem.Numeric9Value;

                        // use value here
                        break;
                    case KeywordDataType.Numeric20:
                        decimal decValue = keywordDataSetItem.Numeric20Value;

                        // use value here
                        break;
                    default:
                        break;
            }
    }
}

1 ACCEPTED ANSWER

Daniel_Quill
Elite Collaborator
Elite Collaborator

Thank you Tom.  That is correct.  If the Dataset is external you would not use the Unity API to modify.  For instance, if your Dataset values are stored in a separate database table you could write an SQL query that would add/remove values to from it and when accessed by OnBase would reflect the changes.

View answer in original post

5 REPLIES 5

Alejandro_Contr
Champ in-the-making
Champ in-the-making

Thank You both, my data set is internal, so... i will try with the external option.