Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SDESSEARCH

SDESSEARCH.m

Go to the documentation of this file.
SDESSEARCH ;ALB/LAB - VISTA SCHEDULING RPCS - GIVEN SEARCH STRING, RETURN LISTS ;Jun 09,2021
 ;;5.3;Scheduling;**790**;Aug 13, 1993;Build 11
 ;;Per VHA Directive 2004-038, this routine should not be modified
 Q
 ;
CLINICSEARCH(CLINICLIST,SEARCHSTRING) ;Given a search string return a clinic list that matches.
 Q:$L(SEARCHSTRING)<2
 N CLINICIEN,CLINICNAME,STRINGLENGTH,CLINICINFO,CLINICCOUNT,INACTIVEDT,REACTIVEDT
 S CLINICIEN="",CLINICCOUNT=0
 S STRINGLENGTH=$L(SEARCHSTRING)
 S CLINICNAME=$O(^SC("B",SEARCHSTRING),-1)
 I $E(CLINICNAME,1,STRINGLENGTH)=SEARCHSTRING D
 . S CLINICNAME=$O(^SC("B",CLINICNAME),-1)
 F  S CLINICNAME=$O(^SC("B",CLINICNAME)) Q:CLINICNAME=""!($E(CLINICNAME,1,STRINGLENGTH)'=SEARCHSTRING)  D
 . Q:(CLINICCOUNT>49)
 . S CLINICIEN=$O(^SC("B",CLINICNAME,""))
 . S INACTIVEDT=$$GET1^DIQ(44,CLINICIEN,2505,"I")
 . S REACTIVEDT=$$GET1^DIQ(44,CLINICIEN,2506,"I")
 . Q:((INACTIVEDT'="")&(INACTIVEDT<=DT))&(((REACTIVEDT'="")&(REACTIVEDT>DT))!(REACTIVEDT=""))  ;do not include inactive clinics
 . S CLINICCOUNT=CLINICCOUNT+1
 . S CLINICINFO("Clinic",CLINICCOUNT,"IEN")=CLINICIEN
 . S CLINICINFO("Clinic",CLINICCOUNT,"Name")=CLINICNAME
 I 'CLINICCOUNT S CLINICINFO("Clinic")=""
 D ENCODE^SDESJSON(.CLINICINFO,.CLINICLIST)
 Q
 ;