Since SmartCare is a normalized database, all global code fields in any table will only contain the code and in order to display the more user friendly global code description, a function will need to be used as follows
![](https://2023.calmhsa.org/wp-content/uploads/2023/12/284-1024x864.png)
In this example, the MaritalStatus and EmploymentStatus are examples of global codes where just the code is in the Clients table. To display the description of the global codes, a function can be used as shown below:
- Enter ssf_GetGlobalCodeNameById prior to database field enclosed in parentheses
![](https://2023.calmhsa.org/wp-content/uploads/2023/12/285-1024x877.png)
- Next, copy the query and add it to the dataset in MS Visual Studio by right clicking on DataSets and choose Add Dataset
![](https://2023.calmhsa.org/wp-content/uploads/2023/12/286-1024x716.png)
- Select Use a dataset embedded in my report, choose Text for Query Type and copy query text into Query: box and then click OK
![](https://2023.calmhsa.org/wp-content/uploads/2023/12/287-1020x1024.png)
- Now the dataset is available under Datasets area of Report Data window
![](https://2023.calmhsa.org/wp-content/uploads/2023/12/288-624x1024.png)
Fields from SQL query created in MS SQL Server Mgmt Studio are now available to insert into report layout in MS Visual Studio