3 Replies Latest reply on Dec 28, 2015 4:33 PM by enzoborze

    Help For Calculate

    enzoborze

      hi, i m new, im medic,I 'm trying to make a program for consultations, we are multiple doctors who conducted consultations and I would like to keep statistics on how many patients they see each, I make a medical field , I wonder how I can group the number of people seen per physician (total) , to perform graphics and not having separate table each record1.jpg

        • 1. Re: Help For Calculate
          dbail22@comcast.net

          If the doctor name is part of the table you are working with you can create a self join of the table using the doctors name as the relationship.  Create a portal with a record number counter added and you can see any data you want.  Otherwise just use the Count(fieldname) command in that relationship and it will count the number of times it finds the name you are currently viewing appears in that table.

          • 2. Re: Help For Calculate
            StephenWonfor

            Enzo

             

            There will be many possible approaches to answer your question - much will depend upon the database architecture.

             

            If you simply need a patient count you could use a script like the one below - just did this for a cline last week.  It specifically does this:

            collects all employee names into a variable, counts the number of employees, creates a date range in which to search then executes a series of FIND operations, gathers the results of each find and writes the results into a global reporting field.

             

            If [ IsEmpty(CALENDAR::_gdDayFrom) or IsEmpty(CALENDAR::_gdDayTo) ]

              Show Custom Dialog [ "Date range required." ]

            End If

            Set Variable [ $From ; Value: CALENDAR::_gdDayFrom ]

            Set Variable [ $To ; Value: CALENDAR::_gdDayTo ]

            Set Variable [ $$Staff ; Value: List(EMPLOYEES|x|::Employee_FullName) ]

            Set Variable [ $$StaffCount ; Value: ValueCount($$Staff) ]

             

            Go to Layout [ “Examinator” (ITEMS) ]

            Set Error Capture [ On ]

            Set Variable [ $$Report ; Value: "" ]

            Set Variable [ $Count ; Value: 1 ]

            Loop

              Enter Find Mode []

              Set Field [ ITEMS::Staff ; GetValue($$Staff;$Count) ]

              Set Field [ ITEMS::ApptDate ; $From & "..." & $To ]

              Perform Find []

              If [ Get ( FoundCount ) > 0 ]

              Set Variable [ $$Report ; Value: List($$Report; GetValue($$Staff;$Count) & Char(9)& Round(ITEMS::∑StaffHours;1)) ]

              End If

              Set Variable [ $Count ; Value: 1 + $Count ]

              Exit Loop If [ $Count > $$StaffCount ]

            End Loop

            Go to Layout [ “Editor” (CALENDAR) ]

            Set Field [ CALENDAR::_gtReporting ; "For the period¶" & $From  & " to " & $To & "¶" &  $$Report ]

             

            Stephen

            • 3. Re: Help For Calculate
              enzoborze

              Thanks dbail22 and stephenwonfor i ll make and tell us