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

IFF()(funtion)

Status
Not open for further replies.

bigdad

Programmer
Jul 17, 2001
34
VE
Hi every body I´ve a doubt with this fuction, My question is: Can I take the result of this fuction and send it to a variable???

hope some body help me please

thanks
bigdad
 
I assume you mean IIF() and not IFF().

Try this:

nValue = 399
thisval = IIF(TYPE('nValue')='N',MONTH(DATE()),CMONTH(DATE()))
? thisval

Yes, you can assign the result of that function to a variable and use it as you need.

 
Sure why whould you think you could not?

IIF is just like any other function it returns a value which can be used anyplace you would use any other function.

Example

lswitch = .t.

x = iif(lswitch,'Blue','Red')

the value of x is 'Blue'
 
IIF() or Immediate If is just a replacement for:

IF COndition
Result2
ELSE
Result2
ENDIF

I use the IIF a lot for checking types like f.i.

LPARAMETERS tcParamaeter

tcParameter = IIF(VARTYPE(tcParameter) = 'C', tcParameter, Space(0))

In this case I make sure the parameter is always of type character and is by default an empty string.

HTH,
Weedz (Edward W.F. Veld)
My private project:Download the CrownBase source code !!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top