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
I'm in version 13

Daniel_Quill
Elite Collaborator
Elite Collaborator
Alejandro,
 
Unfortunely there is no way to this through the API.  Managing the keywords and their datasets must be done through the configuration module.
 
 
 
 

Thomas_Reu
Elite Collaborator
Elite Collaborator

Daniel's answer only applies to internal onbase keyword datasets.  If the keyword dataset points to an external table (e.g. it is an external keyword dataset), then by definition this external table is not part of onbase.  This external table is managed by whatever system owns it - not onbase.  Ergo, you would not need the configuration module to modify it. 

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.