This topic is locked

If one field is empty show another field in list view

4/29/2007 4:30:21 PM
PHPRunner General questions
P
phpwalker author

I have a list of people and addresses.

there are field for home (physical) address and fields for a mailing address.
some people have separate mailing addresses, with PO Box, etc.
I want to create a "mailing list" that will show the home address for each person and the mailing address for those who have a mailing address ... in pseudocode:
if mailing address is empty,

show home address

else show mailing address
fields look like this:

lastName

stNum

Street

City

State

Zip

MalingAddress

MailingCity

MailingState

MailingZip
The SQL statement in Access (which works) looks like this:
SELECT DISTINCT voters.LastName,

IIf(IsNull([MailingAddress]),[houseNum] & " " & [Street] & " " & [AptNo],[MailingAddress]) AS LabelStNum,

IIf(IsNull([MailingAddress]),[City],[MailingCity]) AS labelCity,

IIf(IsNull([MailingAddress]),[State],[MailingState]) AS labelState,

IIf(IsNull([MailingAddress]),[Zip],[MailingZip]) AS labelZip

FROM voters

WHERE (((voters.Party) Not Like "R") AND ((voters.Moved)<>Yes) AND ((voters.Deceased)<>Yes));
To clarify: The if statements for the City (as an example) is as follows:

IIf(isNull[MailingAddress], // if the mailing address is empty

[City], // use the standard city field

[MailingCity], // else use the mailing address city field

As labelCity // put result into a new field called labelCity
The above access statement doesn't translate directly into SQL (I can't just copy and paste it into php runner) and I can't find a way to translate this ... is there a way to do this in phprunner? (i'm currently using php 3.1)
thanks much,
karen

Sergey Kornilov admin 4/30/2007

You can create a new query in MS Access on the top of this SQL statement and save it under some name. After that you can point PHPRunner to this query and use it without any problems.

P
phpwalker author 5/1/2007

You can create a new query in MS Access on the top of this SQL statement and save it under some name. After that you can point PHPRunner to this query and use it without any problems.


I don't understand how I would do this on my webserver? my application is on a hosted site....
karen