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

operator question regarding use of (->) 3

Status
Not open for further replies.

parkfairfax

Programmer
May 22, 2001
63
0
0
US
Has anyone ever seen a statement like this using a operator like -<, eg. if alltrim(customer->password) then...{some code}.

I thought that -> equated to equal, but now I am not sure. Does anyone know the meaning of this?
 
parkfairfax

What are you trying to compare? If you are trying to compare two character values you should use the equal sign.

. if alltrim(customer->password) then...{some code}.

This is more like VB code.

Try
Code:
IF ALLTRIM(CUSTOMER=PASSWORD) 
   ** DO WHATEVER
else
  ** do something else
ENDIF
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
Hi,

Yeah, that operator (->) comes from CA-Clipper, and probably also from any one of several older Xbase languages, even FoxPro. It's the equivalent (in your example) of &quot;dot notation&quot;, so 'customer->password' is the same as 'customer.password' to VFP. It's sort of obsolete, but is still recognized in VFP, probably for backward compatibility. That can be EXTREMELY handy when you're converting old Xbase code to VFP.

Mike Freeland
 
Thanks for your suggestions. I understand this much better now.
 
parkfairfax

I should add that the &quot;->&quot; construct is only for table/view dot notation, not object/property situations etc. Thus, customer->password refers to the contents of a field called 'password' in a table or view called 'customer'.

Assuming I'm on the right track, your example

IF Alltrim(customer->password)

isn't complete, if password is a string. it'd have to be something like this to avoid an error:

IF Alltrim(customer->password) = passwordvar
now some code
endif
It's the same thing as

IF Alltrim(customer.password) = passwordvar

(Alltrim(somevar = someothervar) won't be valid in any case.)

 
Yes, your right. I had abbreviated my statement. I appreciate your comments. I see another problem though in that my program statement is not accurately comparing the 2 string variables. Ie. this part of the programming is allowing the following two strings to equate which they are not.. 11111 = 111111, or street = streett. Any idea what could be going on here, and how I could fix that. Is this a common error in Foxpro string comparison, or am I missing something here. It seems to check for the characters on the left side, but doesn't do an exact match. If it sees the characters in the left variable match up it gives the user a pass which I don't want to do.
 
Use SET EXACT ON or compare using
11111 == 111111
street == streett

Dave S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top