Click or drag to resize

Converting Lookups Between Cultures

Using Lookups to Obtain Values for Areas that do not Fully Support Culture.

Examples

This is an example of how a user can use a non-US english description value to update an area that does not fully support culture. More specifically, if a user knows they wants to update the InvoiceLayout property of a client with the French value of "Facture par défaut", then below is how they can use Get_Lookup to obtain the US English description neccessary to update the client.

VB
 1' Imports SDK2011_01 = [Project Name].schemas.appliedsystems.com.epic.sdk._2011._01
 2' Imports SDK2009_07 = [Project Name].schemas.appliedsystems.com.epic.sdk._2009._07
 3
 4' Constant DATABASE preset to current database name
 5' Constant AUTHENTICATION_KEY set to current authentication key
 6
 7Dim oService As New EpicSDK_2021_01Client ' Instantiate the Service object
 8
 9Dim oHeader As New SDK2009_07.MessageHeader ' Instantiate the Header object
10' Populate the database and authentication key in the Header object
11oHeader.DatabaseName = DATABASE
12oHeader.AuthenticationKey = AUTHENTICATION_KEY
13
14Try
15  'Get lookup in Canadian French
16  oHeader.Culture = "fr-CA"
17  Dim oLookupResultFrenchCA As List(Of SDK2009_07._common.Lookup) = oClient.Get_Lookup(p_oHeader, SDK2009_07._common._lookup.LookupTypes.InvoiceLayout, Nothing)
18
19  'Here we select the lookup item corresponding to a desired French description.
20  Dim oSelectedFrenchLookupItem As SDK2009_07._common.Lookup = oLookupResult.First(Function(x) x.Description = "Facture par défaut")
21
22  'Get lookup in US Engish
23  oHeader.Culture = "en-US"
24  Dim oLookupResultsEnglishUS As List(Of SDK2009_07._common.Lookup) = oClient.Get_Lookup(p_oHeader, SDK2009_07._common._lookup.LookupTypes.InvoiceLayout, Nothing)
25
26  'Find the lookup item by matching on the Code field.
27  Dim oMatchingEnglishLookupItem As SDK2009_07._common.Lookup = oLookupResult.First(Function(x) x.Code = oSelectedFrenchLookupItem.Code)
28
29  'Retrieve a client to update
30  Dim oFilter As New SDK2009_07._get.ClientFilter
31  oFilter.ClientID = 113168 'A known Identifier of a client
32  Dim lClients As SDK2009_07._account.Client = oService.Get_Client(oHeader, oFilter, 0).Clients.First
33  'Update the Client with US English description.
34  oClient.BillingValue.InvoiceLayout = oMatchingEnglishLookupItem.Description
35  oService.Update_Client(oHeader, oClient)
36
37  oService.Close()
38
39Catch ex As Exception
40  Console.WriteLine("Error: " & ex.Detail.Description)
41  Console.WriteLine("Press any key to exit...")
42  Console.ReadLine()
43  Exit Sub
44End Try