View Full Version : script error - not found


Howard G. Cornett
08-20-2004, 07:50 AM
I keep getting a script error when referring to a field that is on the grid component and the component is on the a5w page. Here is the error.

500 Internal Server Error
Script Error
Error: line:14
vcWidth = alltrim(str(Rating))
not found

Alpha Five Web Application Server/6.0 Build/1532 at BUSINESS Port 80

It's not finding Rating. Is there some special way to refer to a field in WAS components that I am missing? Here is the piece of code from the a5w page that is generating this error.

Delete tmpl_reporting
DIM tmpl_reporting as P
DIM vcWidth as c
tmpl_reporting = a5w_load_component("reporting")
'Following code allows you to override settings in the saved component, and specify the component alias (componentName property).
'Tip: Keep the componentName property short because this name is used in page URLs, and it will help keep the URLs short.
'Each component on a page must have a unique alias (componentName property).
with tmpl_reporting
with field_info[7]
vcWidth = alltrim(str(Rating))
Image.InLineStyle = "height: 5px; width: "+chr(34)+vcWidth+chr(34)+"px;"
componentName = "reporting"
end with
end with

Any help is much appreciated.


Selwyn Rabins
08-20-2004, 10:30 AM
this can't work. 'rating' has no meaning in this context.

Selwyn Rabins
08-20-2004, 10:30 AM
New Page 3

p { font-family: Tahoma; font-size: 8pt; margin-top: 0; margin-bottom: 5pt }

Ok, Howard, I think I finally get it.
You want a grid the HTML in one of the columns looks something like this:

"img src="graph.jpg" with="1in""

"img src="graph.jpg" width="1.5in""

"img src="graph.jpg" width="1.75in""

"img src="graph.jpg" width="3in""

While this would be extremely easy to do if you were generating the HTML
using your own Xbasic script, you want to do it as part of a Grid component
because you want to take advantage of everything else that the Grid component
offers (syle sheets, paging, search, sorting etc.).
Unfortunately, I can't think of any way to actually achieve this with the
Grid component. The technique I described in an earlier message about overriding
the Grid component's properties does not apply to your problem because you want
to change a property on every row of the Grid - not for the Grid as a whole.
I have come up with a more generic solution which I will add in a future
patch. I will create a new control type called "Template". Currently, a field
can be an "image", "label", "textbox" etc. However, if a field's type is set to
'template', then you can define your own html for that column.
In the template, you will be able to refer to values from other columns in
the Grid. So, in your case, say you have a column in the Grid called 'rating'
and you want the width attribute to be based on this value, your template for
column would be:

"img src="graph.jpg" width="{rating}" "
I am not sure when I will get this done by, but I will definitely do it
because it is an extremely powerful feature that will dramatically extend the
power of the Grid component.

Howard G. Cornett
08-20-2004, 10:46 AM
You got it exactly, Selwyn! Thanks!


Cheryl Lemire
08-20-2004, 11:22 AM
Hi Howard,

This may not resolve your issue as I am not so sure you want to do the work required. I have created a sample a5w page that displays images by pulling the img src and linking url for it from fields within a table.

I have created a series of tables as lookups and a main table to hold all my image information. My sample page shows all three records that I currently have in the table. It can be filtered to display specific records, by date, by location, etc...

I have attached the a5w page code for your convenience. You can view the sample at: