I have an SQL database that houses Municipal Codes in a hierarchy structure. I need a way to show in Crystal Reports the full Municipal Code. Below is more information and a quick sample of data.
The columns/fields in the database include:
CodeID / Code / Level / ParentCodeID
The Code ID is a unquie ID and is the record that I want to pull the data for. I want to return the code from each level. Level is a value between 1 & 6. The ParentCodeID links back to CodeID at the previous levels. Below is an example
CodeID / Code / Level / ParentCodeID
200 / 6 / 5 / 186
186 / 104 / 4 / 163
163 / 2 / 3 / 28
28 / 1 / 2 / 21
21 / IPMC / 1 / NULL
I want a formula that will look at CodeID 200 and give me the result "IPMC.1.2.104.6" The formula needs to simply give me the Code, then look at the ParentCodeID, then go to that record and get the code and continuing that process until the ParentCodeID is NULL. (It would also have to be in backwards order to show correctly.) I have no idea how to get this to work or if it is even possible in Crystal Reports.
The columns/fields in the database include:
CodeID / Code / Level / ParentCodeID
The Code ID is a unquie ID and is the record that I want to pull the data for. I want to return the code from each level. Level is a value between 1 & 6. The ParentCodeID links back to CodeID at the previous levels. Below is an example
CodeID / Code / Level / ParentCodeID
200 / 6 / 5 / 186
186 / 104 / 4 / 163
163 / 2 / 3 / 28
28 / 1 / 2 / 21
21 / IPMC / 1 / NULL
I want a formula that will look at CodeID 200 and give me the result "IPMC.1.2.104.6" The formula needs to simply give me the Code, then look at the ParentCodeID, then go to that record and get the code and continuing that process until the ParentCodeID is NULL. (It would also have to be in backwards order to show correctly.) I have no idea how to get this to work or if it is even possible in Crystal Reports.