Hello Fox Guru's :<)
My 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. !!!
QUESTIONS: Should my sa_cust be declared as a private or global variable ? Maybe it is updating from within my function. How do I pass a variable by reference ?
Is 'INTO ARRAY" causing the problem?
Thank you,
PM
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"
CODE:
FUNCTION GetSackNo(sc_ship.a_cus[8])
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.
My 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. !!!
QUESTIONS: Should my sa_cust be declared as a private or global variable ? Maybe it is updating from within my function. How do I pass a variable by reference ?
Is 'INTO ARRAY" causing the problem?
Thank you,
PM
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"
CODE:
FUNCTION GetSackNo(sc_ship.a_cus[8])
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.