Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Jamie Osborn
  Where is Jamie Osborn?
 Melbourne
 Australia
 Jamie Osborn
 To: Paul Michael
  Where is Paul Michael?
 Shelton
 Connecticut - United States
 Paul Michael
 Tags
Subject: RE: Syntax problem??? (UPDATE on problem)
Thread ID: 21735 Message ID: 21803 # Views: 1 # Ratings: 0
Version: Visual FoxPro 5 Category: General VFP Topics
Date: Wednesday, April 02, 2003 4:19:34 AM         
   


> Hello Fox Guru's :<)
>
> My update to the problem is as follwed:
>
> PURPOSE: I'm utilizing the POM3Z.DBF to look-up the sack# in reference to what the user Zip to is. What I want happen is my function to check the Zipcode that the user enters or from their consignee data (ARRAY for this field is 'sa_cust[8]'), from there my logic would verify what SACK# (ref. SCFCODE field) falls between the 'zip' & 'zipend' hence, the customer will know what sack/bin they can put their package/envelope goes in. The results from the sack# (ref. the sa_cust[1] array field) would be printed on a doc label. For now I need to capture the sack # on the processing screen.
>
> > > For example: I ship a package to 01023, the Sack # would be 010 (ref. SCFCODE field). Last the Sack number would be displayed on the processing screen (ref. the field/ARRAY that would display data is the 'sa_cust[1] ').
>
> !!! Keep in mind that this function is being intergrated to an existing software program written in (VFP 5.0); customizations such as fuctions are allowed through a prg file (cust_main.prg) and can be called several ways. !!!
>
> Table structure (POMBZ3.dbf)it is as followed:
>
> ZIP char 5
> ZIPEND char 5
> CODE char 5
> ZONE char 3
> SCFCODE char 5
> BMCNUM char 2
> ADCCODE char 5
>
> ATTEMPTS MADE:
> * Tried a WHERE tcZipCode>=Zip and tcZipCode<=Zipend - made no difference.
> * Tried under my Cus_INIT declare sa_cust[1] = "" - made no difference
> * Tried changing your sa_cust[1] = arrRet to sa_cust[1] = arrRet[1] - made no difference
> * Thought maybe the sa_cust array needs to be qualified with sc_ship.sa_ship - made no difference.
>
> I get an error:
> "Operator/Operand type mismatch"
>
> If I run it through vf5 5.0 Debugger I get this error:
>
> Error Message : "Operator/Operand type mismatch"
> Line of code with error: "SELECT scfCode FROM POMB3Z WHERE BETWEEN (tcZipCode,Zip,ZipEnd) INTO ARRAY arrRet"
>
> Is 'INTO ARRAY" causing the problem?????
>
> CODE:
>
> FUNCTION GetSackNo
> LPARAMETERS tcZipCode
> LOCAL llRetVal
> local array arrRet[1]
> SELECT scfCode FROM POMB3Z ;
> WHERE BETWEEN(tcZipCode,Zip,ZipEnd);
> INTO ARRAY arrRet
> IF _TALLY > 0
> sa_cust[1] = arrRet
> llRetVal = .T.
> ELSE
> sa_cust[1] = ""
> llRetVal = .F.
> ENDIF
> RETURN llRetVal
> endfunc
>
> DID A TEST, THE RESULTS ARE AS FOLLWED:
>
> Done this: sa_cust[1] = tcZipCode && Echo back
> return
>
> "I GET 9999999999' in the array/field (Numeric base)"
> "I GET XXXXXXXXXX' in the array/field (Charater base)"
>
> The array vaule is the same no matter if I add a Userdefine Charater or Userdefine Numer.
>
>
> Done this: sa_cust[1] = "hello"
>
> "I GET HELLO in the aaray/field".

Is sa_cust declared as a private or global variable ? If not then you can't be updating it from within your function. Why not pass a variable by reference ?
eg.

PROCEDURE Main
*-- this is whatever method/function/prog calls GetSackNo()
LOCAL sa_cust,lcSfcCode,llOk

DELCARE sa_cust[1]
lcSfcCode = ""
llOk = .T.

llOk = GetSackNo(MyZipVal,@lcSfcCode)

IF llOk
sa_cust[1] = lcSfcCode
*-- Do whatever
ENDIF

RETURN

ENDPROC

FUNCTION GetSackNo
LPARAMETERS tcZipCode,rcSfcCode
LOCAL llRetVal
local array arrRet[1]

llRetVal = .F.
rcSfcCode = ""

SELECT scfCode FROM POMB3Z ;
WHERE BETWEEN(tcZipCode,Zip,ZipEnd);
INTO ARRAY arrRet
IF _TALLY > 0
rcSfcCode = arrRet
llRetVal = .T.
ENDIF
RETURN llRetVal
endfunc

I think that that makes sense ! :)

Cheers,
Jamie
jamie.osborn@foxite.com

COMPLETE THREAD

Syntax problem??? Posted by Paul Michael @ 3/31/2003 9:30:42 PM
RE: Syntax problem??? Posted by Simon Arnold @ 3/31/2003 10:11:38 PM
RE: Syntax problem??? Posted by Paul Michael @ 3/31/2003 10:34:02 PM
RE: Syntax problem??? Posted by Michael Gill @ 4/1/2003 12:46:11 AM
RE: Syntax problem??? Posted by Simon Arnold @ 4/1/2003 1:08:51 PM
RE: Syntax problem??? Posted by Paul Michael @ 4/1/2003 6:41:59 PM
RE: Syntax problem??? Posted by Paul Michael @ 4/1/2003 7:29:43 PM
RE: Syntax problem??? Posted by Michael Gill @ 4/1/2003 7:52:16 PM
RE: Syntax problem??? Posted by Paul Michael @ 4/1/2003 8:01:50 PM
RE: Syntax problem??? Posted by Paul Michael @ 4/1/2003 8:04:35 PM
RE: Syntax problem??? (UPDATE on problem) Posted by Paul Michael @ 4/2/2003 2:34:47 AM
RE: Syntax problem??? (UPDATE on problem) Posted by Jamie Osborn @ 4/2/2003 4:19:34 AM
RE: Syntax problem??? (UPDATE on problem) Posted by Paul Michael @ 4/2/2003 6:12:26 PM