Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hard one! Dynamic menu

Status
Not open for further replies.

Zipster

Programmer
Nov 13, 2000
107
GB
I'm trying to use ASP to create a dynamic a dynamic menu with javascript.

If I hard code the javascript it works fine but now I'm trying to get the results from a database but would like some help on the SQL statement.


Response.write "USETEXTLINKS = 1 //replace 0 with 1 for hyperlinks"

Response.write "// Decide if the tree is to start all open or just showing the root folders"
Response.write "STARTALLOPEN = 0 //replace 0 with 1 to show the whole tree"

Response.write "ICONPATH = '' //change if the gif's folder is a subfolder, for example: 'images/'"

'Root folder does not need to change
Response.write &quot;foldersTree = gFld('<div class = 'personalnotes'>Continents</div>', '')&quot;

'Should like the associated continent
Response.write &quot; aux1 = insFld(foldersTree, gFld('<div class = 'personalnotes'>&quot; & MyContinent(&quot;txtMyContinent&quot;) & &quot;</div>', ''))&quot;

'Should list the country with the associated continent
Response.write &quot; aux2 = insFld(aux1, gFld('<div class = 'personalnotes'>&quot; & MyCountry & &quot;</div>', ''))&quot;

'Should list the Town with the associated country and continent
Response.write &quot; insDoc(aux2, gLnk('R', '<div class = 'personalnotes'>&quot; & MyTown & &quot;</div>', ''))&quot;

Also I would like to have all records distinct (e.g no repeat continents etc.)

Thanks in advance for any help on this complicated question
 
If you want help with SQL you should post to the SQL area, but since I'm here...

What does the database look like? What are the field names and the data? What is the end result you want? What is the SQL have you already written?

I'm not keen on reading javaScript to figure out what you are attempting to do exactly (lots of javaScript headaches lately). The easiest thing for me would be to know what you want to be returned from the database.

To make your results distinct use the keyword &quot;Distinct&quot; or use a &quot;group by&quot; clause (I prefer the group by):
Code:
select distinct emp from payroll
or
Code:
select emp
from   payroll
group by emp
Both of these should have the same effect.
_______________________________________
Ignorance is a beautiful thing:
You don't know what you can't do...
 
Hi,

Thanks for your response.

The ASP above creates some javascript to build a menu. the menu will be as follows:

Continent ¬
Country ¬
Town
Town2
Town3
Country2 ¬
Town
Town2
Town3

I need to create some SQL to pull this info from the database which in each record has a continent, country and Town. The problem is in the way that I have to generate the Javascript, I have to do it like:

''''' START LOOP

'First get continent
Response.write &quot; aux1 = insFld(foldersTree, gFld('<div class = 'personalnotes'>&quot; & MyContinent(&quot;txtMyContinent&quot;) & &quot;</div>', ''))&quot;

'Then get all countries associated with continent
Response.write &quot; aux2 = insFld(aux1, gFld('<div class = 'personalnotes'>&quot; & MyCountry & &quot;</div>', ''))&quot;

'Then get all towns associated with the country and continent
Response.write &quot; insDoc(aux2, gLnk('R', '<div class = 'personalnotes'>&quot; & MyTown & &quot;</div>', ''))&quot;

''''''''''''''''''''''''''''
'Continent.MoveNext

''' LOOP

I hope I'm making sense here.

Thanks.
 
like I said. JavaScript not my friend right now.

I am still wondering how you have the information in the database. What is your table structure? Is it one table or a couple?

The other question is what do you want the output to look like after the ASP has run? What do you want the client browser to receive? _______________________________________
Ignorance is a beautiful thing:
You don't know what you can't do...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top