Hi! two doubts!

# Thread: Hi! two doubts!

1. Member
Join Date
Dec 1969
Posts
58

## Hi! two doubts!

I am working on a weather project and i want to display thats weeks highest temp and that weeks lowest temp.<BR>i tried it like this.. <BR>Hi=((max(SH), max(MH),max(TH),max(WH),max(THH), max(FH), max(SATH))<BR> if Hi &#062;=0 then<BR> color1="cyan"<BR> end if<BR> if Hi &#062;=30 then<BR> color1="grey"... and so on<BR>it returns a error saying expected&#039;)&#039; <BR><BR><BR>2.I want to use session variable in this so that the selected day remains when he user tries another forecast.<BR>&#060;td width="32%"&#062;&#060;select size="1" name="MonW"&#062;<BR> &#060;OPTION Value= "sunanim.gif"&#062; Sunny <BR> &#060;OPTION Value="cloudanim.gif"&#062; Cloudy <BR> &#060;OPTION Value="snow.gif"&#062; Snow <BR> &#060;OPTION Value="windy.gif"&#062; Windy <BR> &#060;OPTION Value="rain.gif"&#062;Rainy<BR><BR>&#060;/td&#062; &#060;/SELECT&#062; <BR><BR>Thank you in advance!!<BR>

2. Senior Member
Join Date
Dec 1969
Posts
935

## as for your first doubt...

look at this:<BR>Hi=((max(SH), max(MH),max(TH),max(WH),max(THH), max(FH), max(SATH))<BR><BR>I&#039;m not so sure of what you want to do here but you have two options:<BR>1 - Hi=(max(SH), max(MH),max(TH),max(WH),max(THH), max(FH), max(SATH))<BR>2 - Hi=((max(SH), max(MH),max(TH),max(WH),max(THH), max(FH), max(SATH)))<BR><BR>as for your second "doubt" I don&#039;t understand what your question is.

3. Senior Member
Join Date
Dec 1969
Posts
417

## RE: Hi! two doubts!

Don&#039;t quite understand you but here goes for question 2.<BR>Firstly, close off each of your &#060;option&#062; tags with a &#060;/option&#062; tag. (that gets on my nerves as I&#039;m running an HTML club at school at the moment!) Secondly, you set session vars by stating Session("variable_name") = value. If you want the option to be selected by default if it is the same as the session variable you stored (and I think that&#039;s what you mean) you should use an If...Then statement on each of your options to insert the "selected" property on the correct option. Anywhere close?

4. Member
Join Date
Dec 1969
Posts
58

## Reg ..first doubt

Regarding my first doubt..<BR>I have this weather table where I have Hi temp and Low temp and Ave for each day.. <BR>Now I want to display the highest temp of the week and the lowest temp of the week .So do I have to use arrays or is there a simpler way to select the highest temp and lowest temp for the week.<BR>eg: sun=90 mom=50 tue=10...so on<BR>I have to display 90 as it is the highest for the week<BR>Please help

5. Senior Member
Join Date
Dec 1969
Posts
935

## nop

I think that an array is the best way for this job....

6. Senior Member
Join Date
Dec 1969
Posts
417

## RE: Reg ..first doubt

You should be able to alter your SQL statement to achieve that. I believe something like "SELECT MAX(temp) AS maxTemp FROM myTable" should do it where temp is the column name of wherever you store your temperatures. To write the temperature to the page, use the key "maxTemp" eg &#060;%=rs("maxTemp")%&#062;.<BR><BR>I think you can do the same with MIN and AVG

7. Senior Member
Join Date
Dec 1969
Posts
935

## oh yeah!

BenCharlton is right, that would be better....

8. Member
Join Date
Dec 1969
Posts
58

## RE: Reg ..first doubt

I dont have a database for this will "ubound" with arrays work?

9. Senior Member
Join Date
Dec 1969
Posts
935

## no, it won't

UBound will just give you the length of the array not the highest value.<BR>as far as I know there is no method that will do that.<BR>you will have to search the array, something like this:<BR>maxValue = arrayName(0)<BR>for iCount=1 to UBound(arrayName)<BR>if arrayName(iCount) &#062; maxValue then<BR>maxValue = arrayName(iCount)<BR>Next

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•