Generic file containing the Company Listing - passed to multiple pages

Posted on 2004-04-06
Medium Priority
Last Modified: 2008-02-01
I use Crystal Reports to manage data from a SQL database. The reports are then converted into ASP pages to make the more accessible.
Over 20 of these reports have Date and Company ID parameters. I am not able to build the Company ID list from values in the database because of permissions... I build the list by setting default values from the .rpt file and then I pass those to the Parameters prompt page. I manually have to update all CompanyID listings, but I know I can have an include file in XML or some other way, where I can call that file to pour those values into the Select statement.

The statment looks something like this:

            <select name="P2" size="10">
                 <option value="ABS">ABS
                 <option value="AILA">AILA
                 <option value="AL BETZ">AL BETZ
                 <option value="AL BETZ_TRAININ">AL BETZ_TRAININ
                 <option value="AQUARIUM PROD">AQUARIUM PROD
                 <option value="ARHD">ARHD
                 <option value="ARHD_ADMIN">ARHD_ADMIN
                 <option value="ARMOR INS">ARMOR INS
                 <option value="AVANSIS">AVANSIS
                 <option value="BITS">BITS
                 <option value="BMA">BMA
                 <option value="BOB HARTWICK">BOB HARTWICK
                 <option value="BONSAL">BONSAL
                 <option value="CANATELLA">CANATELLA
                 <option value="CARSON NEWSOME">CARSON NEWSOME
                 <option value="CASEY FAM SVCS">CASEY FAM SVCS
                 <option value="CASEY FAM_TRNG">CASEY FAM_TRNG
                 <option value="CAYCE">CAYCE
                 <option value="CCP">CCP
                 <option value="CHUCK NEWHALL">CHUCK NEWHALL
                 <option value="COLUMBIA CONTR">COLUMBIA CONTR
                 <option value="COORDINASSETS">COORDINASSETS
                 <option value="DAN HODGES">DAN HODGES
                 <option value="DIRECTOFFICE">DIRECTOFFICE
                 <option value="DMCGRAIN_HM">DMCGRAIN_HM
                 <option value="DULANEY MOTOR">DULANEY MOTOR
                 <option value="DWILMERDING_HM">DWILMERDING_HM
                 <option value="EBECKER_HOME">EBECKER_HOME
                 <option value="FOCUS">FOCUS
                 <option value="FOGLES">FOGLES
                 <option value="GAMES WORKSHOP">GAMES WORKSHOP
                 <option value="GARTLAND">GARTLAND
                 <option value="GROTECH">GROTECH
                 <option value="HOOKMEUP">HOOKMEUP
                 <option value="HUGHES">HUGHES
                 <option value="HUMAN ADVANTAGE">HUMAN ADVANTAGE
                 <option value="HUNT VALLEY MOR">HUNT VALLEY MOR
                 <option value="J. L. PIE">J. L. PIE
                 <option value="JEFF BARNES">JEFF BARNES
                 <option value="JEFF GREENBERG">JEFF GREENBERG
                 <option value="JONES EQUIPMENT">JONES EQUIPMENT
                 <option value="KT INTERIORS">KT INTERIORS
                 <option value="L&H DISTR">L&H DISTR
                 <option value="MARK KATZ">MARK KATZ
                 <option value="MAVA">MAVA
                 <option value="MIETP">MIETP
                 <option value="MILLER BROS.">MILLER BROS.
                 <option value="MKALIS">MKALIS
                 <option value="NATIONAL FRUIT">NATIONAL FRUIT
                 <option value="NAYLOR ANTIQUES">NAYLOR ANTIQUES
                 <option value="NEA DEVELOPMENT">NEA DEVELOPMENT
                 <option value="NEA SP PROJECTS">NEA SP PROJECTS
                 <option value="NEA-TEMP">NEA-TEMP
                 <option value="NEVIS">NEVIS
                 <option value="NOLAN ASSOC">NOLAN ASSOC
                 <option value="PHOENIX">PHOENIX
                 <option value="PRITTS FUNERAL">PRITTS FUNERAL
                 <option value="QUESTMARK">QUESTMARK
                 <option value="RANDISIFAMILY">RANDISIFAMILY
                 <option value="RECRYSTALLIZE">RECRYSTALLIZE
                 <option value="RECRYSTALLIZE30">RECRYSTALLIZE30
                 <option value="REVELLPECHAR">REVELLPECHAR
                 <option value="RIVER PLANTATIO">RIVER PLANTATIO
                 <option value="RIVIANA">RIVIANA
                 <option value="ROUCHARD LAWNSC">ROUCHARD LAWNSC
                 <option value="S & S AUTO">S & S AUTO
                 <option value="S & S AUTO - J">S & S AUTO - J
                 <option value="S & S REPORTS">S & S REPORTS
                 <option value="S&S SPECIAL PR.">S&S SPECIAL PR.
                 <option value="SETTLEMENT SOLU">SETTLEMENT SOLU
                 <option value="STAR SALES">STAR SALES
                 <option value="STERLING">STERLING
                 <option value="STERLINGADVISOR">STERLINGADVISOR
                 <option value="STERLINGCAPITAL">STERLINGCAPITAL
                 <option value="STERLINGFAMOFF">STERLINGFAMOFF
                 <option value="STERLINGFUNDMGN">STERLINGFUNDMGN
                 <option value="STERLINGREALEST">STERLINGREALEST
                 <option value="STERLINGVENTURE">STERLINGVENTURE
                 <option value="STRAUS">STRAUS
                 <option value="SWALKER_HM">SWALKER_HM
                 <option value="TEVIS OIL">TEVIS OIL
                 <option value="THOMPSON AUTO">THOMPSON AUTO
                 <option value="TPETERS">TPETERS
                 <option value="VALHALLA">VALHALLA
                 <option value="VALHALLAMGMT">VALHALLAMGMT
                 <option value="WAHLGREN">WAHLGREN
                 <option value="WALKER VENTURES">WALKER VENTURES
                 <option value="WINER">WINER
                 <option value="WORKFORCE">WORKFORCE
                 <option value="WYNDEMEIR">WYNDEMEIR

How can I make it so that I have only ONE of those, instead of one for each report that uses the CompanyID as a parameter, so that I can simplify the update process?


Question by:gian_the_man
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 26

Expert Comment

ID: 10769547
If you make your <select> well formed, you can use an entity reference in an XML document to include the source.  You need a DTD or schema though, which may open a can of worms you'd rather avoid.

XSLT has an include and import mechanism.  These differ mostly by the effect the source code has once it's been imported/included.  This can include pre-made templates in an XSLT, which might help.  The XSLT spec also has a document() method which allows you to parse an external XML document and make the data available for the transform.  

But neither of these approaches seem to solve the core issue you're having, unless you're already using XML and/or XSLT in here somewhere.  Why can't use simply use a server-side include in the generated ASP pages to include the select?

<!-- #include virtual="/includes/companyId_inc.asp" -->

where companyId_inc.asp contains the select you need?

Mike Sharp


Author Comment

ID: 10769716
Hey Mike,

Thanks for the suggestions...
I don't do much coding anymore, so my theoretical knowledge of web developing is far beyong my actual abilities, at least with ASP. I'm more familiar with PHP... so even though I know what I want, I'm not sure how to actually make it happen.
A server-side include sounds like the way to go, should the include file contain the select statement and that's it?

Will placing the <!-- #include virtual="/includes/companyId_inc.asp" --> on the sepecific select statement call that file and pour in the values?


LVL 26

Accepted Solution

rdcpro earned 1200 total points
ID: 10771185
If you have a dozen ASP pages, and each page needs the same snippet of HTML, then yes, you put the

<!-- #include virtual="/includes/companyId_inc.asp" -->

in each ASP page where you want the snippet of HTML to go, and then place the file that actually contains the snippet (called companyId_inc.asp) someplace where all the ASP pages can find it.  I usually have a directory named "includes" where all these go, unless I need them in different places for some reason.  But it doesn't really matter.

There are two types of server-side includes:

<!-- #include virtual="/includes/companyId_inc.asp" -->

<!-- #include file="c:\inetput\wwwroot\includes\companyId_inc.asp" -->

The Virtual uses IIS to figure out where the file is stored, because you specify a virtual path (URL).  The File syntax uses the actual filesystem location.  Virtual is better, because if you should ever change the physical filesystem location of your site, you don't have to change the paths in the includes.

In any case, companyId_inc.asp is a file that contains the <SELECT> html, and could also contain other server-side includes or ASP code.  SSI (server-side includes) always get exectued BEFORE the ASP code runs.  So it's basically the same thing as creating a single ASP page out of a bunch of snippets, and then executing the whole thing.

Mike Sharp

Author Comment

ID: 10771204
Thanks man, appreciate your help...
I'll try it tomorrow and see how it goes but I don't forsee problems...

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

752 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