Using Dovetail SDK Using Visual Basic.Net

A customer recently asked for a code example demonstrating how to use our Dovetail SDK to do data access custom objects using Generics (the Dovetail kind not the C# kind)

Imports FChoice.Foundation.Clarify
Imports System.Collections.Specialized
Imports FChoice.Foundation
Imports NUnit.Framework

Module SDKExample

    <TestFixture()> Public Class SDK_test
        <Test()> Public Sub update_case_title()


            UseGenericToUpdateExistingCaseTitle("1", "new title")

        End Sub
    End Class

    Sub InitializeDovetailSDK()
        Dim config As New NameValueCollection

        'These are hard coded database credentials. More typically you'd use application
configuration config.Add("fchoice.dbtype", "mssql") config.Add("fchoice.connectionstring", "Data Source=.; Initial Catalog=SDKcl125_2k5;
User Id=sa; Password=sa;") ClarifyApplication.Initialize(config) End Sub Sub UseGenericToUpdateExistingCaseTitle(ByVal caseId As String, ByVal title As String) Dim session As ClarifySession session = ClarifyApplication.Instance.CreateSession("sa", "sa", ClarifyLoginType.User) Dim dataset As New ClarifyDataSet(session) Dim caseGeneric As ClarifyGeneric caseGeneric = dataset.CreateGeneric("case") caseGeneric.AppendFilter("id_number", StringOps.Equals, caseId) caseGeneric.Query() If caseGeneric.Rows.Count < 1 Then Throw New ApplicationException(String.Format("Case {0} was not found.", caseId)) End If caseGeneric.Rows(0)("title") = title dataset.Update(caseGeneric) End Sub End Module

Here is code that uses Dovetail generics to connect to a database, located and update the title of a case. Here is a gist of this code snippet in case I evolve it in the future.



Your email address will not be published.