Hello. I am very bad at ASP and use ASPRunner Pro to write ASP pages for me. I have come across a problem however which I cannot figure out. Quite simply on a list page I have six fields, [G1 Title],[G2Title],[G3Title],[G4Title],[G5Title],[G6Title]. Depending on who has logged in however, not all of these fields will contain a value. Each of these has its own column and is only displayed once via a SELECT DISTINCT statement. In other words [G1 Title] for example is either populated or NULL, it can not be both. All that I want to do is get the ASP page not to show an empty column for [G1 Title] if it is null. I only want the columns for [G1 Title] through to [G6 Title] to display if their respective values are not NULL. Could anybody help me with this? I would be extremely grateful.
Con.
9 3841 jhardman 3,406
Recognized Expert Specialist
show the code that (1)queries the db and (2)builds the table.
Jared
@jhardman
Hi Jared
As I have said I am very bad at ASP so I am not quite sure even what you mean.
The code for the ASP Page is as follows... - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
<HTML {$html_attrs}><HEAD><TITLE>Test</TITLE>
-
<link REL="stylesheet" href="include/style.css" type="text/css"><!--[if IE]><link REL="stylesheet" href="include/styleIE.css" type="text/css"><![endif]-->{BEGIN style_block}
-
<STYLE>
-
#height100{$id} {padding:10px;}
-
#toplinks_caption{$id} {padding:0px 30px;font-size:12px;font-weight:bold;}
-
#mastertable_block{$id} {margin-left:50px;margin-top:10px}
-
#toplinks_block{$id} {width:100%;padding:3px;padding-left:30px}
-
#toplinks_block{$id} span {padding-left:5px;}
-
#search_records_block{$id} { padding-left:20px;}
-
#search_records_block{$id} > * {vertical-align:middle;}
-
#search_records_block{$id} select {margin:3px 0px;}
-
#login_block{$id} {padding:10px; margin-bottom:3px}
-
#login_block{$id} * {margin-left:5px; padding:5px 0px;}
-
#menu_block{$id} {padding:10px;}
-
#menu_block{$id} * {list-style-type:none;}
-
#menu_block{$id} IMG {vertical-align:middle;}
-
#records_block{$id} {margin-left:203px;}
-
#record_controls{$id} {padding:10px 10px;}
-
#record_controls{$id} span {padding-left:10px;}
-
#recordcontrolsadd_block{$id} {padding:10px 10px;border: solid; border-width: 1px; border-color: #C0C0C0;}
-
#recordcontrolsadd_block{$id} span {padding-left:10px;}
-
#grid_block{$id} {border:solid 1px #C0C0C0;}
-
.grid_recordheader{$id} {padding:0 5px 5px;vertical-align:top;}
-
.grid_recordheader{$id} * {margin:0px 5px; vertical-align:top;}
-
body {margin:0px;padding:0px;}
-
</STYLE>
-
{END style_block}
-
<META name=GENERATOR content="MSHTML 8.00.7600.16588"></HEAD>
-
<BODY {$bodyattrs} marginwidth="0" marginheight="0">{BEGIN body}
-
<DIV id="height100{$id}">{$header}
-
{BEGIN toplinks_block}<DIV id="toplinks_block{$id}"> <FONT
-
size=+0><B>Test</B></FONT> <SPAN id="login_block{$id}">Logged on
-
as <B>{$username}</B> <A
-
href="login.asp?a=logout">Log out</A> </SPAN>{BEGIN asearch_link}<SPAN><A
-
href="Test_search.asp">Advanced search</A></SPAN>{END asearch_link} </DIV>{END toplinks_block}
-
<DIV id="recordcontrolsadd_block{$id}" class=shade>{BEGIN search_records_block}<SPAN id="search_records_block{$id}" class=shade>{BEGIN searchform}<SPAN id="searchform{$id}" class=shade><B>Search for: </B> {BEGIN searchform_field}<SELECT id="ctlSearchField{$id}"> <option value="">Any field</OPTION> <option value="ID" {$ID_searchfieldoption}>ID</OPTION> <option value="G1 Title" {$G1_Title_searchfieldoption}>G1 Title</OPTION> <option value="G2 Title" {$G2_Title_searchfieldoption}>G2 Title</OPTION>
-
<option value="G3 Title" {$G3_Title_searchfieldoption}>G3 Title</OPTION> <option value="G4 Title" {$G4_Title_searchfieldoption}>G4 Title</OPTION> <option value="G5 Title" {$G5_Title_searchfieldoption}>G5 Title</OPTION> <option value="G6 Title" {$G6_Title_searchfieldoption}>G6 Title</OPTION></SELECT>{END searchform_field} {BEGIN searchform_option}<SELECT id="ctlSearchOption{$id}"> <option value="Contains" {$Contains_searchtypeoption}>Contains</OPTION> <option value="Equals" {$Equals_searchtypeoption}>Equals</OPTION> <option value="Starts with ..." {$Starts_with_____searchtypeoption}>Starts with ...</OPTION> <option value="More than ..." {$More_than_____searchtypeoption}>More than ...</OPTION> <option value="Less than ..." {$Less_than_____searchtypeoption}>Less than ...</OPTION>
-
<option value="Equal or more than ..." {$Equal_or_more_than_____searchtypeoption}>Equal or more than ...</OPTION>
-
<option value="Equal or less than ..." {$Equal_or_less_than_____searchtypeoption}>Equal or less than ...</OPTION>
-
<option value="Empty" {$Empty_searchtypeoption}>Empty</OPTION></SELECT>{END searchform_option} {BEGIN searchform_text}<INPUT {$searchfor_attrs}>{END searchform_text} {BEGIN searchform_search}<INPUT class=button value=Search type=button {$searchbutton_attrs}>{END searchform_search}
-
{BEGIN searchform_showall}<INPUT class=button value="Show all" type=button {$showallbutton_attrs}>{END searchform_showall}
-
</SPAN>{END searchform}{BEGIN details_block}<SPAN>Details found: <B>{$records_found}</B> </SPAN>{END details_block}
-
{BEGIN pages_block}<SPAN>Page <B>{$page}</B> of <B>{$maxpages}</B></SPAN>{END pages_block}
-
{BEGIN recordspp_block}<SPAN id="recordspp_block{$id}">Records Per Page: <SELECT {$recordspp_attrs}>
-
<option value="10" {$rpp10_selected}>10</OPTION> <option value="20" {$rpp20_selected}>20</OPTION> <option value="30" {$rpp30_selected}>30</OPTION> <option value="50" {$rpp50_selected}>50</OPTION> <option value="100" {$rpp100_selected}>100</OPTION> <option value="500" {$rpp500_selected}>500</OPTION></SELECT> </SPAN>{END recordspp_block}</SPAN>{END search_records_block}</DIV>
-
{BEGIN record_controls}<DIV id="record_controls{$id}"></DIV>{END record_controls}
-
<DIV id="usermessage{$id}" class=message></DIV>
-
{BEGIN grid_block}<TABLE style="WIDTH: 100%" id="grid_block{$id}" border=0 cellSpacing=2 cellPadding=3 name="maintable">
-
<TBODY>
-
{BEGIN grid_header}<TR vAlign=top {$gridHeader_attrs}>{BEGIN record_header}
-
{BEGIN ID_fieldheadercolumn}<TD class=blackshade>{BEGIN ID_fieldheader}<A class=blackshade
-
{$ID_orderlinkattrs}>ID</A> {END ID_fieldheader}</TD>{END ID_fieldheadercolumn}
-
{BEGIN G1_Title_fieldheadercolumn}<TD class=blackshade>{BEGIN G1_Title_fieldheader}<A class=blackshade
-
{$G1_Title_orderlinkattrs}>G1 Title</A> {END G1_Title_fieldheader}</TD>{END G1_Title_fieldheadercolumn}
-
{BEGIN G2_Title_fieldheadercolumn}<TD class=blackshade>{BEGIN G2_Title_fieldheader}<A class=blackshade
-
{$G2_Title_orderlinkattrs}>G2 Title</A> {END G2_Title_fieldheader}</TD>{END G2_Title_fieldheadercolumn}
-
{BEGIN G3_Title_fieldheadercolumn}<TD class=blackshade>{BEGIN G3_Title_fieldheader}<A class=blackshade
-
{$G3_Title_orderlinkattrs}>G3 Title</A> {END G3_Title_fieldheader}</TD>{END G3_Title_fieldheadercolumn}
-
{BEGIN G4_Title_fieldheadercolumn}<TD class=blackshade>{BEGIN G4_Title_fieldheader}<A class=blackshade
-
{$G4_Title_orderlinkattrs}>G4 Title</A> {END G4_Title_fieldheader}</TD>{END G4_Title_fieldheadercolumn}
-
{BEGIN G5_Title_fieldheadercolumn}<TD class=blackshade>{BEGIN G5_Title_fieldheader}<A class=blackshade
-
{$G5_Title_orderlinkattrs}>G5 Title</A> {END G5_Title_fieldheader}</TD>{END G5_Title_fieldheadercolumn}
-
{BEGIN G6_Title_fieldheadercolumn}<TD class=blackshade>{BEGIN G6_Title_fieldheader}<A class=blackshade
-
{$G6_Title_orderlinkattrs}>G6 Title</A> {END G6_Title_fieldheader}</TD>{END G6_Title_fieldheadercolumn}{END record_header}</TR>{END grid_header}
-
{BEGIN grid_row}<TR vAlign=top {$rowattrs} {$rowstyle}>{BEGIN grid_record}
-
{BEGIN ID_fieldcolumn}<TD vAlign=middle align=left {$ID_style}>{$ID_value} </TD>{END ID_fieldcolumn}
-
{BEGIN G1_Title_fieldcolumn}<TD vAlign=middle align=left {$G1_Title_style}>{$G1_Title_value} </TD>{END G1_Title_fieldcolumn}
-
{BEGIN G2_Title_fieldcolumn}<TD vAlign=middle align=left {$G2_Title_style}>{$G2_Title_value} </TD>{END G2_Title_fieldcolumn}
-
{BEGIN G3_Title_fieldcolumn}<TD vAlign=middle align=left {$G3_Title_style}>{$G3_Title_value} </TD>{END G3_Title_fieldcolumn}
-
{BEGIN G4_Title_fieldcolumn}<TD vAlign=middle align=left {$G4_Title_style}>{$G4_Title_value} </TD>{END G4_Title_fieldcolumn}
-
{BEGIN G5_Title_fieldcolumn}<TD vAlign=middle align=left {$G5_Title_style}>{$G5_Title_value} </TD>{END G5_Title_fieldcolumn}
-
{BEGIN G6_Title_fieldcolumn}<TD vAlign=middle align=left {$G6_Title_style}>{$G6_Title_value} </TD>{END G6_Title_fieldcolumn}{END grid_record}</TR>{END grid_row}</TBODY></TABLE>{END grid_block}
-
{BEGIN pagination_block}<DIV class=toplist align=center>{$pagination}</DIV>{END pagination_block}
-
{BEGIN message_block}<DIV class=toplist align=center valign="middle"><B>{$message}</B></DIV>{END message_block}{$footer} </DIV>{END body}</BODY></HTML>
The query is just SELECT * FROM Test but I'm not sure if that's what you mean by the code that queries the db.
Many Thanks
Con
@jhardman
Hi Jared
I just wondered if you had had any thoughts on this? It is giving me a real headache.
Thanks
Con
Why don't you try using isnull function.
Example
strValue = ""
if not isnull(rst.fiel d("Column1")) then strValue = rst.field("Colu mn1")
jhardman 3,406
Recognized Expert Specialist
I don't recognize the code at all, it doesn't look like asp to me. What development environment are you using?
Jared
@jhardman
Hi Jared
It is ASPRunner Pro. So far I have come up with...
if IsNull(("G2")) or IsEmpty ("G2") or ("G2")="" or len("G2")>0 then
xt.assign "G2_fieldheader column",false
xt.assign "G2_fieldcolumn ",false
end if
but this just gets rid of the G2 header and its column whether the value for G2 is null or not. It is as if none of the above if conditions actually mean a NULL value in the database.
Con.
@jhardman
This is classic ASP.
isnull is a function (VBscript and Visual Basic the same) that verifies a variable/field for a NULL
jhardman 3,406
Recognized Expert Specialist @viktorka
no, I recognize isnull, that's fine, what I don't recognize is - # {BEGIN G1_Title_fieldheadercolumn}<TD class=blackshade>{BEGIN G1_Title_fieldheader}<A class=blackshade
-
# {$G1_Title_orderlinkattrs}>G1 Title</A> {END G1_Title_fieldheader}</TD>{END G1_Title_fieldheadercolumn}
This does not look like ASP classic, or ASP.NET. I guess it could just be place-holders for a wysiwyg editor, but this doesn't show how you are connecting to the db.
In asp this code usually looks something like this: - dim objConn, objRS, strQuery
-
set objConn = server.createobject("adodb.connection")
-
objConn.open "DSN=myDSN;UID=myUser;pwd=myPwd"
-
set objRS = server.createobject("adodb.recordset")
-
strQuery = "SELECT * FROM myTable"
-
objRS.open strQuery, objConn
This is the code I'm looking for that queries the db. The code that builds the table is going to look something like this: - <table><tr>
-
<%
-
for each x in objRS.fields
-
response.write "<th>" & x & "</th>" & vbNewLine
-
next %>
-
</tr>
-
<%
-
do until objRS.eof
-
response.write "<tr>"
-
for each x in objRS.fields
-
response.write "<td>" & objRS(x) & "</td>" & vbNewLine
-
next
-
response.write "</tr>"
-
objRS.moveNext
-
loop %>
-
</table>
-
Jared
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Aad Aldus |
last post by:
Ik have created an index on a date field.
99% of all data in the table has a filled in date. 1 % is NULL
When I do a select with clause ... WHERE ADATE IS NULL,
Oracle does not use the index.
Is this correct? or How can I force Oracle to use the index.
Kind reagrds,
Aad.
|
by: DettCom |
last post by:
Hello,
I would like to be able to display or hide fields based on whether a
specific Yes/No radio button is selected. This is in conjunction with
a posting a just made here in the same group related to checkboxes.
Thanks!!!
|
by: Shane Story |
last post by:
I have a dataset with two tables.
I make data view of each table, connect the parent table to one data grid
and the child table to the other datagrid, with a row filter, that gets set
when a user clicks a row in the parent.
I have PK/FK in the tables to know what to display.
I want to hide the PK/FK columns in the U/I, but still use them.
|
by: jeet_sen |
last post by:
Hi,
I have created a table colelcting data from an XML source.
After I built the whole table I ahve given user options to filter out
columns from the table.
For this I have collected all the column values of the table in a
select list box.
Depending on what user selects from the selct list I am displaying the
corresponding columns and hiding the columns which the user has not
selected fromt the list.
|
by: phillip.s.powell |
last post by:
I'm having the most bizarre problem with PHP/MySQL that I've ever
faced and it's an urgent matter (of course) to try to fix it ASAP.
We have one record inserted into a table with 75 columns, whereby half
of the columns are not-null, but for some bizarre reason, the fields
are null. The rest of the columns that are null are completely
scrambled (e.g. "first_name" is in "address2", "fax" is in "url", "url"
is in "last_name", etc.)
This...
| |
by: mudassir368 |
last post by:
--This is the html code
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:TemplateField HeaderText="Agent Name">
<ItemTemplate>
<asp:Label ID="lblagentname" runat="server" Text='<%#Bind("AgentName") %>'></asp:Label>
|
by: Curious |
last post by:
I have a derived class (DistributionItem) that contains a few members.
Now I have a binding list of instances of this class to be displayed
in a grid.
However, extra columns are displayed from the parent class
(IWorkerItemBase). How can I hide those members from the parent class
in the grid?
FYI, my code is below:
|
by: mulamootil |
last post by:
Is there a way to hide fields in a report that do not have any data. I have few fields that have images and I would like to hide them as well whenever there is none. I am using Access 07.
|
by: KPR1977 |
last post by:
In my Access Database in Table1, I have one record that looks something like this. (eg. "fldProd" represents field name, while "Apple" represents field value.)
fldProd - Apple (text value)
fldPIO - CF (text value)
fldFam - 1 (text value)
fldSer - 2 (text value)
fldTra - 3 (text value)
fldInt - LZ (text value)
fildQty - 5 (integer value)
The MasterTable looks like this.
|
by: rywags11 |
last post by:
Hello,
Can anyone help me figure out how to show/hide fields based on information entered in other fields in a form in Access 2007? What I'm looking to do is: When a selection from a drop down is chosen, hidden Yes/No fields (check boxes) that apply to that specific information appear and can be updated by users. The other Yes/No fields that do not apply to the chosen selection remain hidden.
I need to be able to do this for all the...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |