There is bound to be a way, but it eluding me right now.
Getting a list of IDs is easy, but I am missing how to get a list of names.
This is 'simplest' solution that comes to mind:
in the Report/Selection Formulas/Record add a shared variable or 2 like:
shared stringvar drID;
shared stringvar drName;
local stringvar did;
local stringvar dname;
local stringvar p := "|";
did := {table.drID};
dname := {drTable.drName}; //I am assuming that there is a table of doctors and they are linked to some other table via their ID
if instr(drID, p + did + p) = 0 then (
if drID = "" then drID := p;
if drName = "" then drName := p;
drID := drID + did + p;
drName := drName + dname + p;
);
//any othe logic you might want
this will give you 2 pipe delimited strings.
Then you can write a formula like above that will split the strings into arrays
shared stringvar drID;
shared stringvar drName;
local stringvar array drIDarray := split(drID, "|");
local stringvar array drNamearray := split(drName, "|");
then you can loop through the parameter list, match it to the ID array, and having that index, get the name from the drNamearray array using the index.
I would think that there is a more direct route, but this is all that comes to mind.
If you find a better way, that's fine. My goal is to guide others to a solution.
HTH