Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pulling Info from sequencial records

Status
Not open for further replies.

butkus

MIS
Sep 4, 2001
114
US
I have a database module with five tables - one of which can store an unlimited number of child records per instance of adult record. These child records store personal information about individuals involved with the adult record. The goal is to identify particular involvement records (DEF(defendant)/GRD(guardian)/NOK(next of kin))and return them to Shared String Variables for use in on-demand sub reports. For each new child record, a sequence number is assigned (1,2,3,...). I though that I could evaluate each record with the Next({seq.no}) function - but alas it does not work.

Is there a way (using Crystal Syntax) to point to a particular sequence number/do the evaluation/return appropriate values/then point to the next sequence number and do the same for each instance? I have provided the following code for reference: (sorry its so long)

// Shared Variable declarations
*******************************
Shared StringVar vic_name;
Shared StringVar vic_gender;
Shared StringVar vic_grd_name;
Shared StringVar vic_street_num;
Shared StringVar vic_street_direction;
Shared StringVar vic_street_name;
Shared StringVar vic_apart_number;
Shared StringVar vic_city;
Shared StringVar vic_state;
Shared StringVar vic_zip;
Shared StringVar nok_street_num;
Shared StringVar nok_street_direction;
Shared StringVar nok_street_name;
Shared StringVar nok_apart_number;
Shared StringVar nok_city;
Shared StringVar nok_state;
Shared StringVar nok_zip;
Shared StringVar def_name;
Shared StringVar charged_with;
Shared StringVar cause_number;
Shared StringVar court_number;
Shared StringVar nok_name;
Shared StringVar grd_invl;
Shared StringVar nok_invl;

// Shared Variable Assignments
******************************
vic_name :={VCMAST.VC_NAM_GVN1} + " " + {VCMAST.VC_NAM_SUR1};
vic_gender :={VCMAST.VC_SEX};
//***************************
charged_with :={VCMAST.VC_OFN_LIT};
cause_number :={VCVAGR.VA_AGEN_NBR};
court_number :={VCVAGR.VA_CONTACT};
//***************************
// Victims Address Assignment
vic_street_num :={VCMAST.VC_ADR_STNO};
If IsNull({VCMAST.VC_ADR_DIR1}) then
vic_street_direction := "" else
vic_street_direction :=({VCMAST.VC_ADR_DIR1} + ". ");
vic_street_name :={VCMAST.VC_ADR_STR1};
If IsNull({VCMAST.VC_ADR_APT}) then
vic_apart_number := "" else
vic_apart_number :=(",# " + {VCMAST.VC_ADR_APT});
vic_city :={VCMAST.VC_CITY};
vic_state :={VCMAST.VC_ST};
vic_zip :={VCMAST.VC_ZIP};
//*******************************
//Acquire instances of involvement (Defendant/Guardian/Next of Kin) from persons table - first pass
//*******************************
If {VCVPRS.VP_INVL} = "DEF" then
def_name :=({VCVPRS.VP_NAM_GVN1}) + " " + ({VCVPRS.VP_NAM_SUR1})
else
If {VCVPRS.VP_INVL} = "GRD" then
(vic_grd_name :=({VCVPRS.VP_NAM_GVN1}) + " " + ({VCVPRS.VP_NAM_SUR1});
grd_invl :="involved";)
else
If {VCVPRS.VP_INVL} = "NOK" then
(nok_street_num :={VCVPRS.VP_ADR_STNO};
If IsNull({VCVPRS.VP_ADR_DIR1}) then
nok_street_direction := "" else
nok_street_direction :=({VCVPRS.VP_ADR_DIR1} + ". ");
nok_street_name :={VCVPRS.VP_ADR_STR1};
If IsNull({VCVPRS.VP_ADR_APT}) then
nok_apart_number := "" else
nok_apart_number :=(",# " + {VCVPRS.VP_ADR_APT});
nok_city :={VCVPRS.VP_CITY};
nok_state :={VCVPRS.VP_ST};
nok_zip :={VCVPRS.VP_ZIP};
nok_name :=({VCVPRS.VP_NAM_GVN1}) + " " + ({VCVPRS.VP_NAM_SUR1});
nok_invl :="involved";);
// Acquire instances of involvement - Second pass
//***********************************************
Next({VCVPRS.VP_SEQ_NO});

If {VCVPRS.VP_INVL} = "DEF" then
def_name :=({VCVPRS.VP_NAM_GVN1}) + " " + ({VCVPRS.VP_NAM_SUR1})
else
If {VCVPRS.VP_INVL} = "GRD" then
(vic_grd_name :=({VCVPRS.VP_NAM_GVN1}) + " " + ({VCVPRS.VP_NAM_SUR1});
grd_invl :="involved";)
else
If {VCVPRS.VP_INVL} = "NOK" then
(nok_street_num :={VCVPRS.VP_ADR_STNO};
If IsNull({VCVPRS.VP_ADR_DIR1}) then
nok_street_direction := "" else
nok_street_direction :=({VCVPRS.VP_ADR_DIR1} + ". ");
nok_street_name :={VCVPRS.VP_ADR_STR1};
If IsNull({VCVPRS.VP_ADR_APT}) then
nok_apart_number := "" else
nok_apart_number :=(",# " + {VCVPRS.VP_ADR_APT});
nok_city :={VCVPRS.VP_CITY};
nok_state :={VCVPRS.VP_ST};
nok_zip :={VCVPRS.VP_ZIP};
nok_name :=({VCVPRS.VP_NAM_GVN1}) + " " + ({VCVPRS.VP_NAM_SUR1});
nok_invl :="involved";);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top