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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Contact type Question

Status
Not open for further replies.

ggies07

Technical User
Jun 27, 2013
40
US
Hey guys,

I have this report that was created by someone else before I got to this job. I am going to explain how it is set up and show you the details of the report and the formulas.

We are a school with regular couples and then we have partners (same sex). This report makes the Parent 1 - Father and Parent 2 - Mother. I added code in that allowed the Father #2 cell and email to display, but because the mother is already Parent 2, it does not read the Mother #2 contact info because Mother is already in that spot. Make sense?

I studied the setup of the report and added two new vars that would pull Mother # 2 cell and email, and it shows up on the report, but it now shows up on other families info instead of just certain ones, like the regular contact vars do.....Any help with the formula so that it only shows up for same sex couples would be much appreciated! Thanks.

WhilePrintingRecords;

StringVar HomePh;
StringVar P1CellPh;
StringVar P2CellPh;
StringVar P1Email;
StringVar P2Email;
Stringvar Pm;
StringVar Pe;


If {StsRlns_1RlAdrs_1Cnts_1.StsRlns_1RlAdrs_1Cnts_1_Contacttype} in ["Home", "Home Phone", "Father Home Phone", "Mother Home Phone"] then HomePh := {StsRlns_1RlAdrs_1Cnts_1.StsRlns_1RlAdrs_1Cnts_1_Contactnum};
If {StsRlns_1RlAdrs_1Cnts_1.StsRlns_1RlAdrs_1Cnts_1_Contacttype} in ["Father Cell Phone", "Parent 1 Cell Phone"] then P1CellPh := "P1m: " + {StsRlns_1RlAdrs_1Cnts_1.StsRlns_1RlAdrs_1Cnts_1_Contactnum};
If {StsRlns_1RlAdrs_1Cnts_1.StsRlns_1RlAdrs_1Cnts_1_Contacttype} in ["Mother Cell Phone", "Parent 2 Cell Phone", "Father #2 Cell Phone"] then P2CellPh := "P2m: " + {StsRlns_1RlAdrs_1Cnts_1.StsRlns_1RlAdrs_1Cnts_1_Contactnum};
If {StsRlns_1RlAdrs_1Cnts_1.StsRlns_1RlAdrs_1Cnts_1_Contacttype} in ["Father Email", "Parent 1 Email"] then P1Email := "P1e: " + {StsRlns_1RlAdrs_1Cnts_1.StsRlns_1RlAdrs_1Cnts_1_Contactnum};
If {StsRlns_1RlAdrs_1Cnts_1.StsRlns_1RlAdrs_1Cnts_1_Contacttype} in ["Mother Email", "Parent 2 Email", "Father #2 Email"] then P2Email := "P2e: " + {StsRlns_1RlAdrs_1Cnts_1.StsRlns_1RlAdrs_1Cnts_1_Contactnum};

These are the ones I copied and added:
If {StsRlns_1RlAdrs_1Cnts_1.StsRlns_1RlAdrs_1Cnts_1_Contacttype} in ["Mother #2 Cell"] then Pm := "Pm" + {StsRlns_1RlAdrs_1Cnts_1.StsRlns_1RlAdrs_1Cnts_1_Contactnum};
If {StsRlns_1RlAdrs_1Cnts_1.StsRlns_1RlAdrs_1Cnts_1_Contacttype} in ["Mother #2 Email"] then Pe := "Pe" + {StsRlns_1RlAdrs_1Cnts_1.StsRlns_1RlAdrs_1Cnts_1_Contactnum};
 
If I understand the situation correctly, I think the problem is that your database has been set up to allow for a mother (or father) to have than 1 phone number or email address, rather than for a child to have more that 1 mother/father. If I am correct you are trying to solve a database design problem with the reporting tool.

The only way I could see to do it would be to check details for father - if none exist but there are 2 sets of details for the mother, then assume 2 mothers.

However this is a dangerous approach!!. What happens if the father has no email address or mobile phone, but the mother has 2 of each (for example both a work personal mobile phones and emails). In these circumstances you would end up with the assumption of a same sex couple incorrectly.

I would be looking for another way to identify same sex couples and in need go back to the software vendors asking for a fix. Alternatively (or just in the meantime), there may be another field in the database that is not currently used that you could use to flag same sex couples.

Hope this helps.

Cheers
Pete.
 
I'm not sure I follow. Here is what we have on the child's record. It could be any combination depending on what the parents give us and if it's a same sex couple. What baffles me is that me adding the Father #2 cell and email into the coding worked just fine. It added the right information on the right area of the report, but the Mother #2 info did not.



Father Cell Phone
Mother Cell Phone
Father Email
Mother Email
Father #2 Email
Father #2 Cell Phone
Mother #2 Email
Mother #2 Cell Phone
 
Also, we are only pulling those fields and not business contact because this is for our directory book that gets printed.
 
After thinking about it, I guess I could cut the coding into different formula names. So it would be something like:

If [contact type] = "father cell" then [contact number]

And I would have to specify each contact type in the export in the database.

Maybe? hahaha
 
sorry, I don't know how to edit the posts, so I keep making new ones.....The report is first grouped by addressee, so it's weird that any new var would run over into another family if they didn't have that contact type....
 
Are you resetting the variables to empty strings in the Group Header to ensure that nothing carries over from the previous record?
 
I think that was it! Since it was not my report, I missed a formula earlier that had the normal vars in it, but not the new ones I added. I have now added them and it seems to have corrected the problem.

Thanks for your help and guidance though! [bigsmile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top