QTP to always create subfile

Ken Langendock Ken at Langendock.com
Wed Feb 14 18:29:02 CST 2007


Here is the revised code, try this

Ken

 

 

 

Index subfile and Output method

 

set verify

can cle

run Therapist_appts

 

display " "

display
"****************************************************************"

display "* REPORT - Therapist Appointments (By Type)
*"

display
"*--------------------------------------------------------------*"

display "* The first step of this report is to gather appointment info
*"

display "* for the therapist you select within the dates you specify.
*"

display "* This process will take a few moments ... While you wait,
*"

display "* you may want to check and insure that the printer you have
*" 

display "* selected is not in 'Duplex' mode, as this may affect the
*"

display "* report printout.
*"

display
"****************************************************************"

display " "

display " "

 

global temp t_ther_no num * 4 &

parm prompt "Enter Therapist Number (4-digit max) : " &

on errors reprompt 3 times

global temp t_start_dt date century included &

parm prompt "Enter start date for the report (YYYYMMDD) : " &

on errors reprompt 3 times

global temp t_stop_dt date century included &

parm prompt "Enter stop  date for the report (YYYYMMDD) : " &

on errors reprompt 3 times

 

request create_empty_subfile

;access single record file to create empty subfile

access PSY_PATIENT_NEXTNUM

 

temp t_index int * 1

temp tot_appt 

temp tot_canpc

temp tot_canpcmr

temp tot_canta 

temp tot_cantc

temp tot_cantccc 

temp tot_cantcmr 

temp tot_cantcpc 

temp tot_cantcsc 

temp tot_cantdns 

temp tot_cantr 

temp tot_cantu 

temp tot_noshow 

temp tot_att 

temp tot_time 

temp tot_min 

temp tot_pat

 

item t_index = 1

 

SUB THER-20 AT FINAL KEEP &

INCLUDE
T_INDEX,T_THER_NO,TOT_APPT,TOT_CANPC,TOT_CANPCMR,TOT_CANTA,TOT_CANTC, &

TOT_CANTCCC,TOT_CANTCMR,TOT_CANTCPC,TOT_CANTCSC,TOT_CANTDNS,TOT_CANTR, &

TOT_CANTU,TOT_NOSHOW,TOT_ATT,TOT_MIN,TOT_PAT,T_STOP_DT,T_START_DT &

INDEX THER20IDX UNIQUE SEGMENT T_INDEX

 

request Retrieve_appointments

 

acc activity in psy link psy_pat_no,psy_case_no,psy_act_no &

to psy_pat_no,psy_case_no,psy_act_no of activity_therapist in psy

 

sel activity if psy_act_dt ge t_start_dt and psy_act_dt le t_stop_dt

sel activity_therapist if psy_act_therapist_no eq t_ther_no

                   

sort ON PSY_PAT_NO OF ACTIVITY

 

temp t_kount

item t_kount count init 1

 

temp t_tot_appt 

temp t_tot_canpc

temp t_tot_canpcmr

temp t_tot_canta 

temp t_tot_cantc

temp t_tot_cantccc 

temp t_tot_cantcmr 

temp t_tot_cantcpc 

temp t_tot_cantcsc 

temp t_tot_cantdns 

temp t_tot_cantr 

temp t_tot_cantu 

temp t_tot_noshow 

temp t_tot_att 

temp t_tot_time 

temp t_tot_min 

temp t_tot_pat

 

item t_tot_appt sub t_kount

 item t_tot_canpc sub t_kount if psy_act_acknowledge_cd = "PC" 

 item t_tot_canpcmr sub t_kount if psy_act_acknowledge_cd = "PCMR"

 item t_tot_canta sub t_kount if psy_act_acknowledge_cd = "TA"

 item t_tot_cantc sub t_kount if psy_act_acknowledge_cd = "TC"

 item t_tot_cantccc sub t_kount if psy_act_acknowledge_cd = "TCCC"

 item t_tot_cantcmr sub t_kount if psy_act_acknowledge_cd = "TCMR"

 item t_tot_cantcpc sub t_kount if psy_act_acknowledge_cd = "TCPC"

 item t_tot_cantcsc sub t_kount if psy_act_acknowledge_cd = "TCSC"

 item t_tot_cantdns sub t_kount if psy_act_acknowledge_cd = "TDNS"

 item t_tot_cantr sub t_kount if psy_act_acknowledge_cd = "TR"

 item t_tot_cantu sub t_kount if psy_act_acknowledge_cd = "TU"

 item t_tot_noshow sub t_kount if psy_act_acknowledge_cd = "PDNS"

 item t_tot_att sub t_kount if psy_act_acknowledge_cd = "PA"

 item t_tot_time = psy_act_therapist_time if psy_act_therapist_no =
t_ther_no

 item t_tot_min sub tot_time

 item t_tot_pat sub t_kount at psy_pat_no

 

OUTPUT *THER-20 UPDATE ADD AT FINAL VIAINDEX THER20IDX USING 1

 item tot_appt of THER-20 final t_tot_appt

 item tot_canpc of THER-20 final t_tot_canpc 

 item tot_canpcmr of THER-20 final t_tot_canpcmr 

 item tot_canta of THER-20 final t_tot_canta

 item tot_cantc of THER-20 final t_tot_cantc

 item tot_cantccc of THER-20 final t_tot_cantccc

 item tot_cantcmr of THER-20 final t_tot_cantcmr

 item tot_cantcpc of THER-20 final t_tot_cantcpc

 item tot_cantcsc of THER-20 final t_tot_cantcsc

 item tot_cantdns of THER-20 final t_tot_cantdns

 item tot_cantr of THER-20 final t_tot_cantr

 item tot_cantu of THER-20 final t_tot_cantu

 item tot_noshow of THER-20 final t_tot_noshow

 item tot_att of THER-20 final t_tot-att

 item tot_time of THER-20 final t_tot-time

 item tot_min of THER-20 final t_tot-min

 item tot_pat of THER-20 final t_tot_pat

 

build therapist_appts

 

-----Original Message-----
From: Lorry Litman [mailto:LLitman at exchange.hsc.mb.ca] 
Sent: February 14, 2007 6:52 PM
To: Ken at langendock.com; Joe Boyle; Robert Edis
Cc: PowerHouse listserver (E-mail)
Subject: RE: QTP to always create subfile


Thank-you all for your response.
I'm trying both the double subfile method and the subfile plus output
method and have a problem with both.
I'm not sure of the difference (pros/cons) between using the Subfile
index file and Output as suggested by Ken and Joe or the Subfile twice
and overwrite subfile idea by Robert?
 
However,
when I tried the two subfile method I couldn't stop the second subfile
from always overwriting the first subfile even if no records were
selected
So, I switched to the indexed subfile and output method, I've tried a
few different variations, but , basically I either can't get the output
to update a record and/or if I get it to update it actually adds another
record and the values for the items are all 0 except for the global
temporary params.
 
I've included all the code for both methods in case I'm missing
something.
 
 
Thanx
       Lorry



 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sowder.com/pipermail/powerh-l/attachments/20070214/e387c192/attachment-0001.html


More information about the powerh-l mailing list