HTML Code Question

G

Guest

I have been working in FrontPage for a few days. I have created a link to a
Database and am able to get the information out.

I have some fields that are empty or blank. They are specifically time
fields or can be text or memo fields. Almost anyone of my fields can be
empty or blank.

My question is how do I put a statement in the web (HTML,ASP) page to check
for the above condition? So I'm basically looking to do an "If Then Else"
statement such as

if field(Time) is not blank
then print "to " Database field name

Also along the same lines, is it possible to put a "for To" loop or a "Do
While" statement into the code? I have a set of data that I want a section
heading followed by data and so forth. Basically trying to create a
organizational report.

Any question, let me know.
Thanks
Terry
 
A

Andrew Murray

I don't quite know what you're getting at...however,

You can create custom queries in your database results wizard - is this what you
mean? - else you need to write the asp code from scratch, rather than using
Frontpage's code.


If there is data in a field it is going to be written to the database....and
blank fields will have no data in them.....why the need to check?

If you want data validation, you can do this through Frontpage - right click the
field, choose form field properties, then the "validate" button on the dialogue.
Then you can do simple validation such as checking a field has a certain type of
data e.g. numerical or alpha only, or date/time format, or even have it so the
data needs to be required in a certain field or even set a maximum limit on the
number of characters.

Can you supply further info, if I'm on the wrong track here?
 
G

Guest

Andrew you are a bit on the wrong track, so let me see if I can clarify what
I'm looking for.

I'm able to get the information out of the database and onto a web page.
I'm able to format it and make it look good. However, there are certain
fields that don't have any data in them and I do not want to display those
fields if they aren't filled in.

So for example, the following is what I get out of the database and the word
"to" is just normal text with the fields around it.

<DB Field> to <DB Field>
7:00:00 PM to 11:30:00 PM

So if the ending time, which is 11:30 is blank then all I want to show on
the page is

7:00:00 PM not 7:00:00 PM to

And if the line is totally blank, then I don't want it to display anything.
So I'm looking to do some coding that will check to see if the value of a
field is not NULL or BLANK and display the field on the screen.

So the above "IF" statement woud look something like

if Ending_time is not blank
then
print Start_Time to Ending_Time
Else
print Start_Time
Endif

I want to know if I can put a piece of code like the above into the ASP page
so that I can format the output of the data.

I hope I have explained this better.
 
K

Kathleen Anderson [MVP - FrontPage]

Wrap the DatabaseResultsColumn in some script - like this:


<% If fp_rs("Municipality") > " " then %>

<li><b>Municipality:</b>&nbsp;<!--webbot bot="DatabaseResultColumn"
startspan

s-columnnames="ProgramArea,RecordNum,Date,ItemNumber,SplitItem,Session,PA_SA
,ActNumber,Section,Recipient,Municipality,FundsUse,DollarField1,DollarField2
,DollarField3,DollarField4,Any_Previous,DollarField5,FundNum,AgencyNum,SID,P
roject_Num,Description"
s-column="Municipality" b-tableformat="FALSE" b-hashtml="FALSE"
clientside
preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Municipality&lt;font
size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;" b-makelink
b-MenuFormat --><%=FP_FieldVal(fp_rs,"Municipality")%><!--webbot
bot="DatabaseResultColumn" endspan i-checksum="33247" --></li>

<% End If %>


You can also check the value of one field to determine whether to show
another.
 
G

Guest

Kathleen, thanks for the reply. However, the statement below didn't work
either. I had to use the function of IsDate(). When I did that I was able
to determine if the field was blank or not.

Thanks for the help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top