Go Premium for a chance to win a PS4. Enter to Win


New employee

Posted on 2006-10-31
Medium Priority
Last Modified: 2013-12-24
We have a new employee, and he has a reasonable request.
If he sees a field in a ColdFusion page, he wants to know where else that field is referenced, and hopefully where it's being updated or deleted.
What technique (tools) do you use other than doing a text search through all the cfm pages?
This is especially necessary for fields that have common names - field names like "Description".
And also for fields that are passed as arguments to functions, where their names could change.
Question by:psenn
  • 4
  • 4
LVL 20

Expert Comment

ID: 17846069
there isn't really a tool I use, most of the form names I use in forms are uniquely named for that form, and you wouldn't see many different places where a single form name would be used becuase I just reuse the same template/view(for MVC) where I need it.

I'm not sure how everything is structured with your site, but the best way would be to follow the request up the chain, there isn't any tools I'm aware of or have seen in 7 years of development being used by developers for this purpose.

That's not saying there isn't, there might be, but I don't believe that's common and I haven't seen it or heard of it...
I know that's not the answer you were looking for, but I just wanted to add my input, perhaps someone may have used a tool that does what you're looking for, if not it's a good one to add to productivity tools if you can build it...


Author Comment

ID: 17846908
Yeah, something I thought of on the drive home was a "Code Explorer" where you input the page you want to "Explore" and it scans the ColdFusion source code for table and field names.
The following fields are referenced in myPage.cfm:
LVL 20

Expert Comment

ID: 17849435
I've written scripts to parse an entire page which will return various things from the HTML, you could specify all form tags, inputs, selects, images, links, etc... One idea that may be helpful is creating a CFC package, and what would be in this package is different classes for instance a class for CSS, for javascript, CF, HTML, XML, etc... then inside each of those classes/cfc's you have methods/functions which will be something like for example in the HTML class, getFormElements(), getImageElements(), getTableElements(), etc... then a couple arguments you could pass to each is the file name/path, specific element you're searching for, etc... This way you could create a type of admin screen which you could list several checkboxes, radio, or selects which would run one of these components and return exactly what you're looking for. It'll take a bit to create the admin tool, but the end result could be close to what you're looking for, you may be able to get away with doing a batch search as well.... inside each of those methods would be a series of regex's which would parse the page specified for the elements your looking for, and this could get as detailed as the <input> names....
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.


Author Comment

ID: 17849669
Uh huh.
Perhaps a simplistic approach would be to
a. Make a list of all the tables used in the page
b. Make a list of all the fields names in each of the tables used in the page.
c. Do a simple search within the page for those field names.

Trying to figure out if the field belongs to TableA or TableB might be too difficult.
1. <cfoutput name="TableAQry" query="TableA">#Field1#</cfoutput>
2. TableAQry.Field1
3. <cfset TableAQry=TableAObj.View1()>
4. <cfinvoke...>
5. etc, etc.
LVL 20

Expert Comment

ID: 17849906
Lets say you want to parse a page which has two forms, formA and formB.... in each of those forms you have various fields and you want to list all fields in their respective forms....

1) parse the page for forms and store the results in an array....
    FormsArray (2-dimensions)
       [1][1] = FormA
       [1][2] = All Form A Content
       [2][1] = FormB
       [2][2] = All Form B Content
2) loop over the FormsArray and now parse for field names in FormsArray[x][2] creating a list of found field names and store in a second array...
    FieldsArray (2-dimensions)
      [1][1] = FormA
      [1][2] = Field Names List (fieldOne,fieldTwo, etc...)
      [2][1] = FormB
      [2][2] = Field Names List (fieldOne,fieldTwo, etc...)
3) If you want to keep it to one array, this is possible too, you just parse the Form Content before it gets stored to FormsArray[x][2] and create the list there...

I think this would be the most simplistic approach keeping it dynamic, however this still doesn't allow you to see what other views/templates are associated with the one you parse, the only way would be to grab the forms action attribute and then continue on down the line of parsing that associated page, but when it comes to pages with javascript and multiple forms you may start getting pretty complicated with the parsing, anything really is possible, but it'll get difficult very quick when you want to start following the flow and indentifying everything.

Expert Comment

ID: 17914533
I would just use DreamWeaver's Find function and set it to search the entire project. It will create a list of all pages and locations of matches, and clicking on the items in the list will open the file and navigate to the referenced code.

So, for example, if you wanted to see everywhere the field "CustomerID" is used in your project, just seach for CustomerID.

Or am I missing your point?


Author Comment

ID: 17926198
Doing a simple search won't tell you how the variable is being used.
I'm afraid my conclusion is that there's no easy way to get this done.
I'm going to have to manually go through and document which cfm pages update which fields.
I'll probably have a page like TableA.cfm, which lists the fields in TableA and pulls in an associated Help text.
Then there should be a hypertext list of cfm pages that use this field.  
So if the field were Table.Desc, then the list will look something like:
SELECT: Page1.cfm, Page2.cfm
UPDATE: Page3.cfm
DELETE: Page3.cfm

So if you click on the hyperlink, it will take you to a html file, with a named anchor to the first occurance of where that field is being used.
Seems like a lot of work, but the hard part is fleshing out how to document a large project.
Once the creative part is done, the rest will be sort of rote.
LVL 20

Accepted Solution

trailblazzyr55 earned 750 total points
ID: 17930116
The key to making it easy to follow all the elements in your site is having a solid framework in place, this way you don't have to track each form variable in your pages. You know how everything works based on the framework. For a new developer it should then be easy enough to have a couple days to get familiar with the framework in place and the business logic behind it. For junior developers a bit longer. If they still have trouble then its time to question the developer as they should be familiar with how everything works as far as application flow, with the business logic, well it takes a while to get use to in any company so time taken there for familiarity should be very understandable. I have never seen in any of the companies I've worked for a tool to find a specific occurance of a variable. With many of the companies they ran several sites so this task would consume an enormous amount of time as well as once in place wouldn't be used much. So it'd be a bit of wasted time.

I have worked with known frameworks such as Model Glue and Fusebox, as well as custom frameworks which combine ideas from several frameworks like the one I currently work with being a custom cocktail of Model-Glue, Mach II, and Fusebox. And in using these I've never had a problem finding a variable I was looking for because you can narrow it down very quickly with the framework in place. You can parse each page in your site for variables, form elements, etc... and store this in a table on a database to search, however with any new developments to the site, it may prove to be quite a task to keep everyone updating the database. So consider the impact with keeping the information current as well.


Author Comment

ID: 17938006
I agree with your assessment of the situation, but I was really hoping to find some sort of tool.
Jeff Peters talks about Fuseminder in the latest issue of cfdj, but that presupposes I'm using fusedocs.

I'll close this question out.
Thanks everyone.

Featured Post

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question