Luke Posted October 28, 2007 Report Share Posted October 28, 2007 Hello all,I've seen several questions about creating links on each record of a report to be able to click to the full individual or family screen. This is accomplished by encapsulating a particular data string with the appropriate <a href=> html codes.This works in TNG Report because the output of the SQL is expected to be HTML. This will not look good with other SQL processors which print out text rather than HTML. Therefore, the following SQL is TNG Report specific.The key to doing this is the"concat" statement which strings together constant HTML statements with the fields from the database:concat('<a href="getperson.php?personID=',f.husband,'&tree=', f.gedcom,'">',h.firstname,' ',h.lastname,'</a>') as Husband, In the above example we are looking at the "family" table joined with the "people" table. First an HTML link is created with the "husband" and "gedcom"(tree) fields. Then the "firstname" and "lastname" fields are strung together as the link title. Finally the end link code is appended and the entire thing is called "Husband" Following is an SQL statement with an example of both family and individual HTML links This query finds the size of all families, placing the largest first. SELECT concat('<a href="familygroup.php?familyID=',f.familyid, '&tree=', f.gedcom,'">', f.familyid,'</a>') as familyid, concat('<a href="familygroup.php?familyID=',f.familyid, '&tree=', f.gedcom,'">', if(isnull(h.lastname), ' ',h.lastname),'/ ',if(isnull(w.lastname), ' ',w.lastname),'</a>') as FamilyName,count(c.personid) as Size, group_concat(ch.firstname order by ordernum separator ', ') as Children, concat('<a href="getperson.php?personID=',f.husband,'&tree=', f.gedcom,'">',h.firstname,' ',h.lastname,'</a>') as Husband, concat('<a href="getperson.php?personID=',f.wife,'&tree=', f.gedcom,'">',w.firstname,' ',w.lastname,'</a>') as Wife, f.marrdate, f.marrplace, f.branch as Branch FROM tng_families as f left join tng_people as h on f.gedcom = h.gedcom and f.husband = h.personid left join tng_people as w on f.gedcom=w.gedcom and f.wife = w.personid left join tng_children as c on f.gedcom=c.gedcom and f.familyid = c.familyid left join tng_people as ch on f.gedcom=ch.gedcom and c.personid = ch.personid WHERE f.gedcom = 'weerts' group by c.gedcom,c.familyid order by Size desc, h.lastname,w.lastname,h.firstname, w.firstnameAny questions? Just ask.Luke Quote Link to comment Share on other sites More sharing options...
aewold Posted December 1, 2007 Report Share Posted December 1, 2007 This SQL report (from a modified Luke report) shows the number of children fathered by the men in the database.SELECT f.gedcom, count(c.personid) as Children,concat('<a href="descendtext.php?personID=',h.personid,'&tree=TREENAME&display=block&generations=2">',concat(h.firstname,' ',h.lastname),'</a>') as HusbandFROM tng_families as fleft join tng_people as h on f.gedcom=h.gedcom and f.husband = h.personidleft join tng_people as w on f.gedcom=w.gedcom and f.wife = w.personidjoin tng_children as c on f.gedcom=c.gedcom and f.familyid = c.familyidWHERE f.gedcom = "TREENAME" AND h.firstname NOT LIKE '(null%'group by c.gedcom,h.personidorder by Children desc Quite handy for those of us with polygamists in our lines. Change the two TREENAME's to your tree names, and you can remove the "AND h.firstname NOT LIKE '(null%' " section (I use "(null child)" for generation place holders from obituaries.)The Husband's Name link will bring up a 2 generation text Descendancy report for the man.Andy Quote Link to comment Share on other sites More sharing options...
Brewmaster Posted December 3, 2007 Report Share Posted December 3, 2007 This SQL report (from a modified Luke report) shows the number of children fathered by the men in the database.SELECT f.gedcom, count(c.personid) as Children,concat('<a href="descendtext.php?personID=',h.personid,'&tree=TREENAME&display=block&generations=2">',concat(h.firstname,' ',h.lastname),'</a>') as HusbandFROM tng_families as fleft join tng_people as h on f.gedcom=h.gedcom and f.husband = h.personidleft join tng_people as w on f.gedcom=w.gedcom and f.wife = w.personidjoin tng_children as c on f.gedcom=c.gedcom and f.familyid = c.familyidWHERE f.gedcom = "TREENAME" AND h.firstname NOT LIKE '(null%'group by c.gedcom,h.personidorder by Children desc Quite handy for those of us with polygamists in our lines. Change the two TREENAME's to your tree names, and you can remove the "AND h.firstname NOT LIKE '(null%' " section (I use "(null child)" for generation place holders from obituaries.)The Husband's Name link will bring up a 2 generation text Descendancy report for the man.AndyAny idea what went wrong? This is the response to running that script in reports...SELECT f.gedcom, count(c.personid) as Children, concat('',concat(h.firstname,' ',h.lastname),'') as Husband FROM tng_families as f left join tng_people as h on f.gedcom=h.gedcom and f.husband = h.personid left join tng_people as w on f.gedcom=w.gedcom and f.wife = w.personid join tng_children as c on f.gedcom=c.gedcom and f.familyid = c.familyid WHERE f.gedcom = "difava-brandt" AND h.firstname NOT LIKE '(null%' group by c.gedcom,h.personid order by Children desc ('',concat(h.firstname,' ',h.lastname), is high;ighted and underlined and claims to be the error...Now I'm lost!!!!Brewmaster Quote Link to comment Share on other sites More sharing options...
aewold Posted December 4, 2007 Report Share Posted December 4, 2007 Brewmaster,Just change the concat('',concat(h.firstname,' ',h.lastname),'') as Husband to the following concat(concat(h.firstname,' ',h.lastname)) as Husband(but you will not have the link to the person)Andy Quote Link to comment Share on other sites More sharing options...
Torben Posted December 22, 2007 Report Share Posted December 22, 2007 Hello all,I've seen several questions about creating links on each record of a report to be able to click to the full individual or family screen. This is accomplished by encapsulating a particular data string with the appropriate <a href=> html codes.This works in TNG Report because the output of the SQL is expected to be HTML. This will not look good with other SQL processors which print out text rather than HTML. Therefore, the following SQL is TNG Report specific.The key to doing this is the"concat" statement which strings together constant HTML statements with the fields from the database:concat('<a href="getperson.php?personID=',f.husband,'&tree=', f.gedcom,'">',h.firstname,' ',h.lastname,'</a>') as Husband, In the above example we are looking at the "family" table joined with the "people" table. First an HTML link is created with the "husband" and "gedcom"(tree) fields. Then the "firstname" and "lastname" fields are strung together as the link title. Finally the end link code is appended and the entire thing is called "Husband" Following is an SQL statement with an example of both family and individual HTML links This query finds the size of all families, placing the largest first. SELECT concat('<a href="familygroup.php?familyID=',f.familyid, '&tree=', f.gedcom,'">', f.familyid,'</a>') as familyid, concat('<a href="familygroup.php?familyID=',f.familyid, '&tree=', f.gedcom,'">', if(isnull(h.lastname), ' ',h.lastname),'/ ',if(isnull(w.lastname), ' ',w.lastname),'</a>') as FamilyName,count(c.personid) as Size, group_concat(ch.firstname order by ordernum separator ', ') as Children, concat('<a href="getperson.php?personID=',f.husband,'&tree=', f.gedcom,'">',h.firstname,' ',h.lastname,'</a>') as Husband, concat('<a href="getperson.php?personID=',f.wife,'&tree=', f.gedcom,'">',w.firstname,' ',w.lastname,'</a>') as Wife, f.marrdate, f.marrplace, f.branch as Branch FROM tng_families as f left join tng_people as h on f.gedcom = h.gedcom and f.husband = h.personid left join tng_people as w on f.gedcom=w.gedcom and f.wife = w.personid left join tng_children as c on f.gedcom=c.gedcom and f.familyid = c.familyid left join tng_people as ch on f.gedcom=ch.gedcom and c.personid = ch.personid WHERE f.gedcom = 'weerts' group by c.gedcom,c.familyid order by Size desc, h.lastname,w.lastname,h.firstname, w.firstnameAny questions? Just ask.LukeHi LukeIs it possible to change this report, so it only shows living people, when I'm or one of my users are loged inTorben Quote Link to comment Share on other sites More sharing options...
genhcn Posted June 5, 2010 Report Share Posted June 5, 2010 Bonjour!Trouver les familles les plus nombreusesExactement ce que je cherchaisPossible d'avoir le code prêt à l'emploi?Je ne suis pas très forte en programmation et j'aimerais bien avoir cet élément sur ma page d'accueil.http://www.genhcn.net/genealogie/Not speak english... sorry for my english.Hi!Find the largest familiesExactly what I wantPossible to have the code ready?I'm not very good at programming. I would like to have this item on my homepageThank!Nat Quote Link to comment Share on other sites More sharing options...
genhcn Posted June 7, 2010 Report Share Posted June 7, 2010 Quelqu'un pour m'aider à construire cette page?Comment se servir de ce code où le placer?J'aurais besoin d'un peu d'indice....someone to help me build this page?How to use this code? where?Thank'sNat Quote Link to comment Share on other sites More sharing options...
Ken Roy Posted June 7, 2010 Report Share Posted June 7, 2010 Quelqu'un pour m'aider à construire cette page?Comment se servir de ce code où le placer?J'aurais besoin d'un peu d'indice....someone to help me build this page?How to use this code? where?Thank'sNatNat,To create this report, go to TNG Admin >> Reports1 - select Add New2 - Enter a Title for the report, like Largest Family Report3 - Enter a Description for the report, like The Largest Family Report was provided by Luke Weerts on the <a href="http://www.tngforum.us/index.php?s=&showtopic=2907&view=findpost&p=13260" target="_blank">TNG Forum</a>4 - Copy the SQL statement within the Code section in the TNG Forum Post above http://www.tngforum.us/index.php?s=&sh...ost&p=132605 - Paste it in the TNG input field just above the Save button6 - Change every '&tree=' to '&tree=your-treeID' where treeID is the ID you assigned to your tree record, mine is T00017 - update the WHERE f.gedcom = 'weerts' to replace weerts with your treeID8 - save the report9 - use the test icon to test the report. It produced a listing of Matches 1 to 50 of 5250Note that at this point, the report is not Active and therefore not available in the public side of the site. Whether you make it active will be up to you. Personally, I would not since I have over 8000 marriages in my database, so it will use quite a bit of resources.Sorry, I did not get a change to translate it to French, even though I read, write, and speak French.Ken Quote Link to comment Share on other sites More sharing options...
genhcn Posted June 7, 2010 Report Share Posted June 7, 2010 My english is bad and Google traduction is very, very bad!MERCI MERCI MERCI Thank you!!!!I'm understand now!TNG is realy fantastic script! I wish I could put this result publicJ'aimerais pouvoir mettre ce résultat public!Je travaille à la généalogie d'une région et je suis certaine que ça plairait beaucoup aux gens de voir les familles nombreuses.I work in the genealogy of a region and I am sure it would please many people to see Top-10 or Top-20 large families. Quote Link to comment Share on other sites More sharing options...
Ken Roy Posted June 7, 2010 Report Share Posted June 7, 2010 My english is bad and Google traduction is very, very bad!MERCI MERCI MERCI Thank you!!!!I'm understand now!TNG is realy fantastic script! I wish I could put this result publicJ'aimerais pouvoir mettre ce résultat public!Je travaille à la généalogie d'une région et je suis certaine que ça plairait beaucoup aux gens de voir les familles nombreuses.I work in the genealogy of a region and I am sure it would please many people to see Top-10 or Top-20 large families.Note that all you would need to do is set the report Active to Yes, when you add a new report it defaults to No.Vous avez simplement a selectionner Oui pour marquer le rapport Actif Quote Link to comment Share on other sites More sharing options...
genhcn Posted June 8, 2010 Report Share Posted June 8, 2010 Je vois...Sauf queOn voit aussi le code!De plus, je dois limiter la demande au 10 ou 15 familles les + nombreuses, sinon, c'est beaucoup, j'ai 14,766 familles dans ma base. Quote Link to comment Share on other sites More sharing options...
Ken Roy Posted June 8, 2010 Report Share Posted June 8, 2010 Je vois...Sauf queOn voit aussi le code!De plus, je dois limiter la demande au 10 ou 15 familles les + nombreuses, sinon, c'est beaucoup, j'ai 14,766 familles dans ma base.le code SQL est seulement montrer quand l'administrateur test le rapport. Yous devrez demander sur la liste User2 comment limiter le rapport aux 15 familles principalles The SQL code is only shown when the Admin is testing the report. You might ask on the User2 list or in the forum how to limit the output to the top 15 families Quote Link to comment Share on other sites More sharing options...
genhcn Posted June 8, 2010 Report Share Posted June 8, 2010 Merci de votre aide et votre patienceThank you for your help and your patience.Demain, je regarde tout ça et j'essayeraiTomorrow, I look at it and I'll tryCe script m'impressionne vraiment beaucoup par sa simplicité car je ne connais pas beaucoup de chose en php/mysql et je réussis à personnaliser beaucoup de chose. Encore merciNat Quote Link to comment Share on other sites More sharing options...
billard Posted June 27, 2013 Report Share Posted June 27, 2013 :!: Bonjour,j'ai créé des rapports multiples. I created multiple reports.Certains montrent des liens actifs pour chaque individu (Some show active links for each individual): balance- librad'autres ne donnent que des liens inactifs: erreur 404 "Not found" (others give only inactive links: 404 "Not found"):Guerre 1914-1918comment obtenir des liens fiables? how to get reliable links?Il est certain que pour les francophones les explications sont difficilement compréhensibles.... Y-a-t-il une communauté francophone??? (It is certain that for Francophones explanations are difficult to understand .... When a French-speaking community??)Gracias Serge My Webpage Quote Link to comment Share on other sites More sharing options...
billard Posted June 27, 2013 Report Share Posted June 27, 2013 :oops: De plus je n'ai pas compris comment limiter le nombre de famille dans le rapport (Also I did not understand how to limit the number of families in the report): Les Familles les Plus NombreusesIl est certain que pour les francophones les explications sont difficilement compréhensibles.... Y-a-t-il une communauté francophone??? (It is certain that for Francophones explanations are difficult to understand .... When a French-speaking community??)Gracias Serge My Webpage Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.