Solved

New employee

Posted on 2006-10-31
9
139 Views
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.
0
Comment
Question by:psenn
  • 4
  • 4
9 Comments
 
LVL 20

Expert Comment

by:trailblazzyr55
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...

~trail
0
 

Author Comment

by:psenn
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:
<ol>
<li>TableA</li>
<ul>
<li>Field1</li>
<li>Field2</li>
</ul>
<li>TableB</li>
<ul>
<li>Field3</li>
</ul>
</ol>
0
 
LVL 20

Expert Comment

by:trailblazzyr55
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....
0
 

Author Comment

by:psenn
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()>
    #TableAQry.Field1#
4. <cfinvoke...>
5. etc, etc.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 20

Expert Comment

by:trailblazzyr55
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.
0
 
LVL 7

Expert Comment

by:ExpertAdmin
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?

M@
0
 

Author Comment

by:psenn
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.
0
 
LVL 20

Accepted Solution

by:
trailblazzyr55 earned 250 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.

~trail
0
 

Author Comment

by:psenn
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.

Sigh.
I'll close this question out.
Thanks everyone.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now