Using v2026. I have a field with multiple persons id’s separated by comma (i.e. 111111A, 22222B, 33333C). I show them in a lookup field, showing their “surnames, name” comma separated.
Then, the field shows:
Surname1, Name1Surname2, Name2Surname3,Name3
How can I setup the field to show:
Surname1, Name1
Surname2, Name2
Surname3, Name3
?
I’m trying with regex, but there’s no rule to separate “Name1Surname2”
If you have no additional settings, the display value should be comma separated by default, e.g. Surname1, Name1, Surname2, Name2, Surname3, Name3. But the commas between the options are missing, you should check your Multiple option separator setting (which is global for all lookup fields).
Where did you see the field's display value without option separators? In the selection list in Add/Edit page? Or in the display value in List/View page?
If you want to fully customize how the value is displayed in List/View page, you may write your Custom View Tag.
As always, you’re right, the comma is there, but when I copied the values, it’s not copied.
The values are shown as Surname1, Name1, Surname2, Name2, Surname3, Name3
I’ve changed the Multiple option separator to several values (i.e. - or |) in order to make a str_replace in row_rendered (something like $finalValue = str_replace("|", "<br>", $this->operarios->ViewValue) but when I re-generate all the scripts, the values shown are (in the list page) 111111A, 22222B, 33333C. When I revert the value to a comma, the lookup values (name, surname) are shown.
I’ve been reading the Custom View Tag examples, but I have no idea how to adapt it to show what I want.
As mentioned, the multiple option separator is global, don't change it if you only want to change the display value of a particular field.
Your code won't work, you may want to check the value of $this->operarios->ViewValue first, then try to modify it. In your particular case, if the display value for each id always contains a comma, then you need to replace the comma between ids (the commas in even positions).
If you use Custom View Tag, you start from the $this->operarios->DbValue and look up the display values and concatenate them by <br> yourself.