If Then Problem - 2 Fields into one Common Field

# Thread: If Then Problem - 2 Fields into one Common Field

1. sav Guest

## If Then Problem - 2 Fields into one Common Field

Iam using an autotable to display products, prices etc. Each product has a retail and a wholesale price. What I want is when a user logs on to the site and he or she happens to be a wholesaler or Retailer only the apropriate wholesale or retail price appears in the displayed price field...<BR><BR> I have tryed to use if then in the query in order to output the price into one common field ie:<BR>"<BR>SELLECT Pname, PDescription, if CustomerRate = &#039;w&#039; then PWholePrice AS FinalPrice Else If CustomerRate = &#039;R&#039; PRetailPrice AS FinalPrice End If<BR>From Customers,Products<BR>"<BR>But its not accepted - I am trying to output the price into a common field because when the user chooses to buy then its the common field that gets passed on into the Shopping Cart.<BR><BR>Does this make sence? Or am I missing something?<BR> <BR>Thanks in advance.<BR><BR>P.S Iam using DB2k <BR><BR>

2. Senior Member
Join Date
Dec 1969
Posts
1,505

## Just write 2 queries and execute one in the If..El

like this:<BR>if CustomerRate="W" then<BR>qry = "SELLECT Pname, PDescription, PWholePrice from Ordertable"<BR>else<BR>qry = "SELLECT Pname, PDescription, PRetailPrice from Ordertable"<BR>end if<BR><BR>conn.execute(qry)<BR> <BR>

3. sav Guest

## RE: Just write 2 queries and execute one

Iam still new to this so please exucuse the following question.<BR>Where do I execute that from?<BR>

4. Senior Member
Join Date
Dec 1969
Posts
1,505

## First tell me this..

how do you know whether I am a "wholeseller" or a "Retailer", where do you have that info about the person who is loggin in ?

5. sav Guest

## RE: First tell me this..

When the user logs fist logs in I store the Rating in a session Variable. after that I can filter any recordset with the value stored in session.<BR><BR>With Drumbeat thats quite easy.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•