RE: SYNTAX PROBLEM??? (UPDATE ON PROBLEM)
From: Jamie Osborn
To: Paul Michael
Connecticut - United States
Syntax problem??? (UPDATE on problem)
RE: Syntax problem??? (UPDATE on problem)
Visual FoxPro 5
General VFP Topics
Wednesday, April 02, 2003 4:19:34 AM
This message was rated by:
> 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'), 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 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 ').
> !!! 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 = "" - made no difference
> * Tried changing your sa_cust = arrRet to sa_cust = arrRet - 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?????
> FUNCTION GetSackNo
> LPARAMETERS tcZipCode
> LOCAL llRetVal
> local array arrRet
> SELECT scfCode FROM POMB3Z ;
> WHERE BETWEEN(tcZipCode,Zip,ZipEnd);
> INTO ARRAY arrRet
> IF _TALLY > 0
> sa_cust = arrRet
> llRetVal = .T.
> sa_cust = ""
> llRetVal = .F.
> RETURN llRetVal
> DID A TEST, THE RESULTS ARE AS FOLLWED:
> Done this: sa_cust = tcZipCode && Echo back
> "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 = "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 ?
*-- this is whatever method/function/prog calls GetSackNo()
lcSfcCode = ""
llOk = .T.
llOk = GetSackNo(MyZipVal,@lcSfcCode)
sa_cust = lcSfcCode
*-- Do whatever
local array arrRet
llRetVal = .F.
rcSfcCode = ""
SELECT scfCode FROM POMB3Z ;
INTO ARRAY arrRet
IF _TALLY > 0
rcSfcCode = arrRet
llRetVal = .T.
I think that that makes sense ! :)