@Su27 ,
Here's how you can correct the error and achieve the functionality you're looking for:
Split Industry Values:
You've used Split(Industry, ",") to separate the industries. This is correct and should give you a table of industries.
Split City Codes:
To split CityCodes within the gallery, you need to ensure that you are referencing a text field. If CityCode is the name of the field that contains the comma-separated city codes, the formula should reference the current item in the gallery. For example:
Split(ThisItem.CityCode, ",")
Get Latest City Code Version:
To get the latest version after the "~", you need to further split each item in the CityCode column and then take the last item. This requires a nested split:
ForAll(Split(ThisItem.CityCode, ","), Last(Split(Result, "~")).Result
Lookup CityCodeName:
To find the CityCodeName, you would use the Lookup function along with the ForAll function, since now you have a table of city codes:
ForAll(Split(ThisItem.CityCode, ","),
Lookup(CityCodeTable, CityCode = Last(Split(Result, "~")).Result).CityCodeName
)
If you think my solution is helpful for you, then please accept it. 😊 Regards, Muhammad Mudassar Mazhar.