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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

aphanumeric to integer?

Status
Not open for further replies.

kaeserea

Programmer
Feb 26, 2003
164
DE
Hello!

I'd like to have an IF Statement:
IF DATE LE &TODATE AND GE &FROMDATE

Unfortunately all the variables and the field DATE are alphanumeric and I get the error:

(FOC280) COMPARISON BETWEEN COMPUTATIONAL AND ALPHA VALUES IS NOT ALLOWED

What can I do here?

Thanx
Eva
 
Try this if it's in a DEFINE or COMPUTE;

IF (DATE LE '&TODATE') AND (DATE GE '&FROMDATE')

the () are not required, but clarify the logic. If this is a screening statement in a TABLE, try:

WHERE (DATE LE '&TODATE') AND (DATE GE '&FROMDATE');

or

IF DATE FROM '&FROMDATE' TO '&TODATE'

HTH
 
Hi HTH,

unfortunately it doesn't work...

Eva
 
You need to post more of your code. Run the FOCEXEC with ECHO=ON and post the code which is echoed back to your screen.

EX focexec ECHO=ON
 
Hi kiddpete,

I oversaw something you wrote:
IF DATE FROM '&FROMDATE' TO '&TODATE'
This worked! But I wonder why this works and the other suggestion doesn't.... Maybe you know why.

And: thanx for your help!
Eva
 
What are the contents of &FROMDATE and &TODATE, and what is the format of DATE? That may answer the question.
 
They're all alphanumeric. I guess that's why you have to put the variable into ' and ' . But the rest.. I don't know.
 
No, tell me the actual content of &FROMDATE and &TODATE and the length of DATE. Is &FROMDATE 20031231, 12/31/2003, or whatever it is.
 
Hi kiddpete,

all of the variables and the field DATE have the format 20030228. The field DATE is an A8.

Eva
 
I'm drawing a blank. I don't see why all three forms don't work, but if the 'FROM TO' formulation works, go with it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top