Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ ASP and VBScript _ Quick If Statement Question From Ignorant Person

Posted by: TinyGiant2010 Mar 14 2017, 10:05 AM

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.

Posted by: TinyGiant2010 Mar 14 2017, 07:34 PM

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

Posted by: tina t Mar 14 2017, 10:17 PM

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.


Posted by: TinyGiant2010 Mar 15 2017, 11:54 AM

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 . ;-)


Posted by: TinyGiant2010 Mar 15 2017, 03:39 PM

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?"

Posted by: TinyGiant2010 Mar 17 2017, 05:41 PM


<% 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).