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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Icon next to report name (2) 1

Status
Not open for further replies.

ahmun

IS-IT--Management
Jan 7, 2002
432
US
Due to some code posted in the original thread making the whole thread not very readable... I post this.

To see the threads that lead up to this topic, click here:
thread333-959828

Ekta... let's continue the discussion using this thread.



Earnie Eng
 
Hi Earnie,

Thanks for replying. I made some changes to the code as below

Code:
dim status
  status = rs("status")
  dim statusdependent, tdcheckbox, strImage
  if status = STATUS_READY then
  'set the HTML code for the image tag with link
    strImage = "<A target=""_blank"" href=""document.asp?job=" 
    strImage = strImage & jobid & "&doc=" & filename & """>"  
    strImage = strImage & "<IMG SRC='" & GenerateIcon(rs("filename")) & "' /></A>"
    statusdependent = "<A target=""_blank"" href=""document.asp?job=" & jobid & "&doc=" & filename & """>"  & ucase(reportname) & "</A>"
  else
    strImage = "<IMG SRC='" & GenerateIcon(rs("filename")) & "' />"
    statusdependent = ucase(reportname) 
  end if

Response.Write "<TD>" & statusdependent & "</TD>" [COLOR=red]Response.Write[/color] "<TD align=""right"">" & strImage & "</TD></TR>" & vbCRLF

It gives me an error at Response.Write saying "Expected at end of statement". I don't see any syntax error.

Thanks,

Ekta


 
Each VBScript statement must be on a separate line. That means you need to change that section to:
Code:
Response.Write "<TD>" & statusdependent & "</TD>" 
Response.Write "<TD align=""right"">" & strImage & "</TD></TR>" & vbCRLF
Separate lines, see?

Alternately it could be written as one long line with concatenation, replacing the second Response.Write with an ampersand (&), like this:
Code:
Response.Write "<TD>" & statusdependent & "</TD>" & "<TD align=""right"">" & strImage & "</TD></TR>" & vbCRLF
or even just eliminate it and put it all on one line (which is the way it will turn out in the HTML anyway):
Code:
Response.Write "<TD>" & statusdependent & "</TD> <TD align=""right"">" & strImage & "</TD></TR>" & vbCRLF
 
Thanks Genimuse. That error is gone. I don't get any error but my icons are not displaying. The page dispays icon with x on it and '/> next to it. Although I can click on it and it does open the report correctly. Only the icons are not displaying. I think there is something wrong with the syntax of image tag maybe.

Code:
dim status
  status = rs("status")
  dim statusdependent, tdcheckbox, strImage
  if status = STATUS_READY then
  'set the HTML code for the image tag with link
    strImage = "<A target=""_blank"" href=""document.asp?job=" 
    strImage = strImage & jobid & "&doc=" & filename & """>"  
    strImage = strImage & [COLOR=red]"<IMG SRC='" & GenerateIcon(rs("filename")) & "'/>[/color]</A>"
    statusdependent = "<A target=""_blank"" href=""document.asp?job=" & jobid & "&doc=" & filename & """>"  & ucase(reportname) & "</A>"
  else
    strImage = "<IMG SRC='" & GenerateIcon(rs("filename")) & "' />"
    statusdependent = ucase(reportname) 
  end if

Thanks,

Ekta
 
hm... I don't see anything syntatically wrong with it...

a few thoughts:
[ul][li]Does it have the problem for both cases? (with and w/o a report with status ready)[/li]
[li]Perhaps you can try replacing the single quotes around the SRC of the image with double-quotes (you will have to use "double" double-quotes to escape the character so that the server doesn't get confused)[/li][/ul]

can you view the source of the html and see if it looks wrong? (or copy and paste it here and let us see)



Earnie Eng
 
It has a problem with both the cases. I did change it to double quotes but it gives expected end of statement error and points to filename

Code:
strImage = strImage & "<IMG SRC="" & GenerateIcon(rs("filename")) & ""/></A>"
 
Here is my HTML code

Code:
<HTML>
<HEAD>
<TITLE>MMS > RGD > RST</TITLE>
<LINK REL="StyleSheet" HREF="styles.css">
<META HTTP-EQUIV="REFRESH" CONTENT="1200;URL=/rst.asp">
</HEAD>


<P>
Click the report name to view the report.
</P>

<BODY class="spooler">

<FORM id=theform action="/rst.asp?" method="post">

<TABLE ID="table0" border=0 cellpadding=2>
  <THEAD nowrap>
    <TH></TH>
    <TH width="120" align="left">
	<a href="rst.asp?orderBy=statustext
	">STATE</a>
	</TH>
    <TH width="20">
	<a href="rst.asp?orderBy=pages
	">PAGES</a>
	</TH>
    <TH width="180" align="right">
	<a href="rst.asp?orderBy=entered
	">RUN DATE/TIME</a>
	</TH>
    <TH width="10"></TH>
    <TH width="90" align="left">
	<a href="rst.asp?orderBy=USER_INITIALS
	">USERID</a>
	</TH>
    <TH width="180" align="left">
	<a href="rst.asp?orderBy=USERDEFINED
	">USER-DEFINED</a>
	</TH>
    <TH width="90" align="left">
	<a href="rst.asp?orderBy=reportname
	">REPORT</a>
	</TH>
	<TH width="10" align="right">ICON  </TH>
	
  </THEAD>

<TR><TD><INPUT type=checkbox name="JOB712"></TD><TD>READY</TD><TD align="right">840</TD><TD align="right">12/10/2004 18:35</TD><TD>&nbsp;</TD><TD>EA40&nbsp;EK1</TD><TD>      </TD><TD><A target="_blank" href="document.asp?job=712&doc=LOGALL.rtf">LOGALL</A></TD><TD align="right"><A target="_blank" href="document.asp?job=712&doc=LOGALL.rtf"><IMG SRC='<img src='../Images/RTF.gif'>'/></A></TD></TR>
<TR><TD><INPUT type=checkbox name="JOB711"></TD><TD>READY</TD><TD align="right">1</TD><TD align="right">12/8/2004 21:17</TD><TD>&nbsp;</TD><TD>EA40&nbsp;JOJ</TD><TD>      </TD><TD><A target="_blank" href="document.asp?job=711&doc=NAPREP.rtf">NAPREP</A></TD><TD align="right"><A target="_blank" href="document.asp?job=711&doc=NAPREP.rtf"><IMG SRC='<img src='../Images/RTF.gif'>'/></A></TD></TR>

    <TR height=60 valign=center>
      <TD colspan=6>
      <INPUT class="buttontext" type=button value="GO TO REP" onClick="location.replace('rep.asp')">
      <INPUT class="buttontext" type=button value="Refresh" onClick="javascript:window.location=window.location;">
      <INPUT class="buttontext" type=submit value="Delete Marked" name=delete>
      </TD>
    </TR>
    
</TABLE>
</FORM>

<P>
Reports are automatically deleted after 30 days.
</P>
</BODY>
</HTML>
 
I think it has to do with your GenerateIcon function.

It is duplicating the IMG tag HTML code.

Either modify the output of the function to omit the IMG tag, or omit the IMG tag in the response.write code.

Does that make sense?

Earnie Eng
 
Yea it does. But how should I modify the code?
 
It's up to you...

Since the name of your function is "GenerateIcon", I would expect it to return just the path to the icon... as oppsed to an IMG tag... That way you can use it in other places as well w/o being limited to it only generating IMG tags...

so...

either have GenerateIcon spit back JUST the filename and path..

OR

omit the IMG tag string syntax in the response.write part of your code

I'd choose the former... but do what makes sense to you...



Earnie Eng
 
Thanks Earnie.. dat did it.. i removed the image tag from the Generate function. One last thing. I want to remove the hyperlink from ard the image. I tried the STYLE="TEXT-DECORATION: NONE tag but thats not working. How should I remove the hypelink.

Code:
strImage = "<A target=""_blank"" href=""document.asp?job=" 
    strImage = strImage & jobid & "&doc=" & filename & """ STYLE="TEXT-DECORATION:NONE">"  
    strImage = strImage & "<IMG SRC='" & GenerateIcon(rs("filename")) & "'/></A>"
 
figured it out.. thanks for all your help. I appreciate it.
 
Glad things worked out for ya!

Earnie Eng
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top