Forums

Advice sought on approach

austega 20 Sep, 2010
I am looking for some high level advice at this point.

I have the latest CF and CC and am relatively new to them, though I have built a few forms and used them to write to and read from database tables. I have copied the example in the forum of adding a Search filter at the top of a CC table display and got it to work (after seeing the advice to Enable Forms in the Data Connection!) - http://test2.sag.org.au/databases/soldiersandmarines.html.

OK here is what I still am trying to do and my proposed method of doing it - any advice or suggestions or references well appreciated!

1. I want to use the Search Filter on top of the CC table display, with sortable columns (found the post http://www.chronoengine.com/forums.html?cont=posts&f=12&t=13182&hilit=search+tables&start=45#p54608 but want the initial records display to be empty rather than showing the full records of the table. I intend to try to control this with PHP code - and somehow find the right spot in the CC data connection to insert it?

2. My client wants to have, in addition, a master search page where a user can enter search terms in a couple of key fields common to several data tables, and then select which data tables to search over - and then be returned with the number of hits from each data table with links to, rather than actual display of, the actual filtered records from each table. They want the search to be publicly available with the actual records only available to financial members. I have searched the forums and do not seem to find any CF/CC solutions for A. searches over multiple tables, or B. for returns of record count rather than records or C. for links to displays of filtered records. On this basis I propose to do this page (apart from the CF search field entry form) in raw PHP/mySQL (a different learning curve) with the links then going to the CC table displays with the search field entries passed to them. Is there a better simpler approach, or one that uses CF/CC more integrally as part of it?

Finally I haven't yet purchased GreyHead's CF cook book - does this address these more CC related issues?
austega 22 Sep, 2010
Mmmm... no takers on some advice on approach? 😟
GreyHead 24 Sep, 2010
Hi austega,

Just back from a week away and off-line.

1) Is relatively simple. Just set a default value for a search that will always return no results. Just what this should be would depend on the table data you are using. You could, for example, use PHP in the where box to check if any filters are set and if there are none add WHERE 'true' = 'false' to the query.

2) Is much more complex. ChrnoConnectivity in it's present form can only search a single table. There is a hacked version in the forums that I believe can handle complex queries though I haven't tested it.

You can do it I think with a custom combination of ChronoForms and ChronoConnectivity. I think I'd start with a ChronoForm to pick the table and link to one of several ChronoConnectivity Listings (one linked to each table) to display the results.

You can persuade ChronoConnectivity to show a records count and no records by using appropriate code to control the display.

The ChronoForms Book doesn't have anything about ChronoConnectivity (the publishers limited me to 350 pages and that chapter got chopped). I have started writing up some ChronoConnectivity tutorials though that you can download from http://greyhead.net/how-to-docs/chronoconnectivity

Bob
austega 28 Sep, 2010
Thanks Bob, thought you must have been away - wondered if anyone else would respond.

Have purchased your book - very useful even if not covering CC - would you like a review anywhere?

Can I explore your comments on my second issue a little further.

There are two options - one of which uses the hacked CC to return results from multiple tables and one that you suggest that breaks the process into a number of steps. I want to play back what I think these two approaches are to make sure I am not walking in the wrong direction!

1. Your suggested approach:
A. CF form to capture user's search terms and checkbox selection of db tables to search
B. Using a sequence of CC instances to return the matching count on each selected db table together with a link to the CC listings (behind a financial member gateway)
C. Financial member users can click on the link to see the CC returned records list for each db table

2. Hacked CC approach:
A. CF form to capture user's search terms and checkbox selection of db tables to search
B. Using a single hacked CC instance to return the matching count over all the selected db tables together with a link to the single CC listing (behind a financial member gateway)
C. User can click on the link to see the CC returned records list for all the selected db table

The magic that I am most concerned about is the B parts. I was thinking that in 1B, it might have been easier to not use CC but rather write raw PHP code/mySQL queries to loop through and return the counts from each selected db table and then provide links to separate standard CC listings for each of the data tables with the search terms passed through as POST variables.

Am I off track?

In regard to the hacked CC approach, are there any known downsides other than a new CC version would overwrite the hacks?
GreyHead 28 Sep, 2010
Hi austega,

I made an error in my earlier post and should have written "one of several ChronoConnectivity Listings (one linked to each table) to display the results." (I wrote 'several ChronoForms'). Now corrected.

I have some slight differences with your version.

In 1B (as you say further down) I would use a ChronoForms to get all the results back from the tables and write the list of results and the links.

In 2A I'd use the Header box of the CC Listing to build the form and thus combine 2A & 2B together. Though off the top of my head I'm not sure how you'd identify the results by table. (You could possibly also combine 2C into the same listing).

Overall, although it's not so elegant, I think that Route 1 might be simpler to build and manage.

Bob
austega 28 Sep, 2010
Thanks Bob. Time to get hands dirty... :?
This topic is locked and no more replies can be posted.