Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting Y or N to text

Status
Not open for further replies.

BROWNIE56

Programmer
Dec 28, 2000
31
US
I have a field the has the work days in it display as
"NYYYYNN". N=Closed Y=Yes

How would I change this to display the days of the week that are open. Example:

NYYYYYN would equal MTWTHF for the days of the week that a clinic is open.

Some clinics are only open 2 days a week so I will need the fields to look like W Th

Any suggestions?

Thanks.
Brownie
 
off the top of my head (as long as the field is always 7 chars long):

local stringvar daysopen;
if {field}[1] = "Y" then daysopen := daysopen +"Su ";
if {field}[2] = "Y" then daysopen := daysopen +"M ";
if {field}[3] = "Y" then daysopen := daysopen +"T ";
if {field}[4] = "Y" then daysopen := daysopen +"W ";
if {field}[5] = "Y" then daysopen := daysopen +"Th ";
if {field}[6] = "Y" then daysopen := daysopen +"F ";
if {field}[7] = "Y" then daysopen := daysopen +"Sa ";
daysopen := left(daysopen, length(daysopen)-1);
daysopen


hth


Icytrue

icytrue@hotmail.com

 
Thank you, thank you, thank you!

It worked!

Brownie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top