Does anyone know how does the GID field in USRINFO join with GROUPLIST table? I need the get the list of active user with the group name.
The column GroupList in the table USR/USERINFO is a comma-separated list of groups to which the user belongs. Each group ID in the list is a GID in the USRGROUP table. The tricky part is parsing the list. Good Luck.
This is how I approached the very same issue. I use the Group field to know what team a doctor is on, or if the doctor is a resident. The following example groups all my residents together, but you can see the ' //"R2018" ' that I could have used. This assumes each doctor would only meet one condition. To simplify, I used a local variable GrpList that was passed the GROUPLIST data from the USERINFO file - in this case, a renamed reference PCP_USERINFO since I often also link to the Document and call that DOC_USERINFO.
//Nov 1 2013 = logic to pull first 'floor' out of group field
//July 2 2014 = added codes for r17 and r18
local stringvar GrpList;
GrpList := {PCP_USRINFO.GROUPLIST};
if(instr(1,GrpList,"1698831238257470")>0) then "PDC"
else if(instr(1,GrpList,"1335347352101420")>0) then "4A"
else if(instr(1,GrpList,"1335347352151420")>0) then "4B"
else if(instr(1,GrpList,"1335347352201420")>0) then "5_"
else if(instr(1,GrpList,"1335347352251420")>0) then "6A"
else if(instr(1,GrpList,"1698910784006150")>0) then "6B"
else if(instr(1,GrpList,"1678806963406480")>0) then "Res" //"R2013"
else if(instr(1,GrpList,"1678806963456480")>0) then "Res" //"R2014"
else if(instr(1,GrpList,"1678806993006480")>0) then "Res" //"R2015"
else if(instr(1,GrpList,"1684935172056650")>0) then "Res" //"R2016"
else if(instr(1,GrpList,"1711622697258470")>0) then "Res" //"R2017"
else if(instr(1,GrpList,"1711622727008470")>0) then "Res" //"R2018"
else if(instr(1,GrpList,"1698831238257470")>0) then "PDC"
else "_unk"