This topic is locked
[SOLVED]

 parsing a text field and creatig new lines to display

3/26/2018 1:47:30 PM
PHPRunner General questions
DRG Lab author

Hello All,
I need to take a text field in my database that contains a large amount of data that is comma-separated and display it in separate lines.
Example

A text field contains this info...

"4 Calprotectin, 1 Luminex xTAG, 8 H. pylori stool antigen (IgA), 9 Lactoferrin, 3 Anti-gliadin IgA, 10 H. pylori Panel, 6 Fecal Fat, 11 Antibiotic Resistance Panel, 2 C. difficile Tox A/ Tox B, 5 Elastase, 7 Fecal Occult Blood, 12 Shigella"
I want to display it in a large text area in my application as:
4 Calprotectin

1 Luminex xTAG

8 H. pylori stool antigen (IgA)

9 Lactoferrin

3 Anti-gliadin IgA

10 H. pylori Panel

6 Fecal Fat

11 Antibiotic Resistance Panel

2 C. difficile Tox A/ Tox B

5 Elastase

7 Fecal Occult Blood

12 Shigella
How might I force a new line after each comma in PHPRunner v9.8?

jadachDevClub member 3/26/2018

Without giving this a whole lot of thought, you can try replacing ',' with '<br />' then display as html.

Sergey Kornilov admin 3/26/2018

Yes, you can try to set 'View as' type to Custom and use the following code:

$value = str_replace(",", "
", $value);
DRG Lab author 3/26/2018



Without giving this a whole lot of thought, you can try replacing ',' with '<br />' then display as html.


This works, but I don't want to add html markup to the data in the database.
Thanks!

DRG Lab author 3/26/2018

this worked as I needed.
Thanks for the quick reply!

DRG Lab author 3/26/2018



Yes, you can try to set 'View as' type to Custom and use the following code:

$value = str_replace(",", "
", $value);



This worked as I needed.
Thank you!