This topic is locked

Linking Tables and displaying data ..

10/16/2008 5:07:50 PM
ASPRunnerPro General questions
G
GerryT author

Hi,
I am interested in this product and so far it seems to do everything I want it to do and I am very close to purchasing the product today, but I am having one issue and want to see if there is a way to do it.
I have 2 tables for instance:
table 1:
ID#

Name

Date
Table 2:

ID#

CDate

File
I can link table 1 to # 2 and that seems fine but when I create a report for instance for table #2 can I get it to display the Name field from table 1 in the report? If not in the report page possibly the custom view?
Also in the report or custom view can I have it highlight in red for any record that is out of date (example: if my date field in the table is 01/01/2005 and i know the expiration date is 3 years from that and todays date is 01/01/2009 (4years not 3) it can highlight that record in red?)
thanks!!

G
GerryT author 10/16/2008

Ok, I figured out how to link the two different tables to view the different data using the SQL Query Page and using joins as listed in the documentation.
Does anyone know how I can get the row to hight red if the date field in the table is past 3 years from it?
Example: Date is 1/1/2005 in the field if it is past 1/1/2008 it should hight red.

Sergey Kornilov admin 10/16/2008

Here is the idea. Use List page: After record processed event and the following sample code that highlights rows with Price > 50000:

if CDbl(rs("price")) >50000 then

row("rowstyle")="style='background:red'"

end if


In your case you need to calculate the date difference between date in database field and the current date using DateDiff function:

if DateDiff("yyyy",Now,rs("DateField"))>=3 then

row("rowstyle")="style='background:red'"

end if


Replace DateField with the actual field name.

More info: http://www.w3schools.com/vbScript/func_datediff.asp