UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Quick If Statement Question From Ignorant Person, html/asp old stuff    
 
   
TinyGiant2010
post Mar 14 2017, 10:05 AM
Post#1



Posts: 156
Joined: 1-June 10



I have HTML page open. I have an existing paragraph that is no longer useful, because now the contents of the paragraph will need to change based upon a dollar value contained in the field [now list]. I never thought I'd need to "swap paragraphs" based on a value.

I need help, as I've never had a programming course in my entire life. Here's what I need, and I keep asking myself "how hard can this be?"

If a numeric value for the field [now list] is >5; write paragraph one;
if [now list] is <5; write paragraph 2.

I don't know how to structure the IF statement in code; nor do I know how to tell the code what "paragraph01" and "paragraph02" are.

We can say paragraph01 = Gracie is a good dog.
We can say paragraph02 = Tom is a mean cat.
(or paragraphs of any length/contents)

Assistance is highly appreciated.

ps: yes I know I goofed years ago by naming a field with a space between 2 words: [now list] - yes, I've lived to regret it, but it's embedded and pervasive and I don't want to fix it today.

--------------------
Self taught newbie just trying to remember that fields are in tables and controls are on forms.
Go to the top of the page
 
TinyGiant2010
post Mar 14 2017, 07:34 PM
Post#2



Posts: 156
Joined: 1-June 10



Or, in reality, Paragraph 1 = about 20 sentences
Paragraph 2 = about 3 sentences.

--------------------
Self taught newbie just trying to remember that fields are in tables and controls are on forms.
Go to the top of the page
 
tina t
post Mar 14 2017, 10:17 PM
Post#3



Posts: 5,163
Joined: 11-November 10
From: SoCal, USA


QUOTE
If a numeric value for the field [now list] is >5; write paragraph one;
if [now list] is <5; write paragraph 2.

sorry i can't help with the code itself, but i will mention that you'll need to tighten up the logic a bit. the above logic statement takes care of values 4 and under, and values 6 and over - but doesn't address the value of 5 at all. unless field [now list] will never, ever = 5, you'll need to close that gap.

hth
tina

--------------------
"you can't take the sky from me"
Go to the top of the page
 
TinyGiant2010
post Mar 15 2017, 11:54 AM
Post#4



Posts: 156
Joined: 1-June 10



fwiw - I just set the default value of [now list] to be equal to 1.

Reality is the spread of relevant values will be very close to 1, the new default, and the next highest number will be >100.

I'm trying to enable tracking of sheriff sales in the same database table as I track properties listed/sold by Realtors. A Realtor will have a [now list] value which represents the current asking price. The Sheriff, on the other hand, has no "asking price" whatsoever, only the sales price. My problem arises because I built the search page on my website to find homes (available and/or sold) based upon the latest asking price; a value that doesn't exist for a Sheriff sale.

The paragraphs referenced above will be #1 normal commentary by Realtors; or #2 notice that this record is a Sheriff sale.

Probably way more than you needed to know . ;-)

Thanks.

--------------------
Self taught newbie just trying to remember that fields are in tables and controls are on forms.
Go to the top of the page
 
TinyGiant2010
post Mar 15 2017, 03:39 PM
Post#5



Posts: 156
Joined: 1-June 10



This is how I show the [now list] in my .asp page

<% =FormatCurrency(rs("Now List"), 0) %>

which shows dollars, with no cents.

I tried to plug in my statement in the vicinity of where I want the paragraphs to switch. Here's what I started with, which didn't work.

IF [now list]<5,
then "oh my gosh"
else "would you believe this?"
ENDIF

--------------------
Self taught newbie just trying to remember that fields are in tables and controls are on forms.
Go to the top of the page
 
TinyGiant2010
post Mar 17 2017, 05:41 PM
Post#6



Posts: 156
Joined: 1-June 10



Solution:

<% if (rs.Fields("now list")>5) then %>
<p>This is the true response.</p>
<% else %>
<p>Write the FALSE response. </p>
<% end if %>

Thanks made in other thread(s).

--------------------
Self taught newbie just trying to remember that fields are in tables and controls are on forms.
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    22nd September 2017 - 10:49 PM