Posted by Robert G Laurin on February 19, 2019 at 14:00:15:
Oh boy! Where to start....
I just modified a program (added a few lines of code).
LET VWEIGHT = 0 ! All New Lines, except the original One
IF NUM(TALENGTH$,ERR) > 0
LET VWEIGHT = ( NUM(TALENGTH$,ERR) * NUM(TAWIDTH$,ERR) * NUM(TAHEIGHT$,ERR) ) / 5000
IF TAWEIGHT > VWEIGHT
LET WEIGHT$ = RSUB(STR(TAWEIGHT*.001),2,6) ! Original Line
LET WEIGHT$ = RSUB(STR(VWEIGHT*.001),2,6)
TAWEIGHT 5.0 is the scale weight in Grams and is never Zero
TALENGTH$, TAWIDTH$ and TAHEIGHT$ are the parcel dimentsion in mm
VWEIGHT 5.0 is the Volumetric Equivalent Weight in Grams.
WEIGHT$ 6 is the Weight converted to KG used to Print.
What is done, is first default the VWEIGHT to Zero, then if LENGTH is present, compute the VE Weight.
If the scale weight (TAWEIGHT) is greater that the VWEIGHT (or VWEIGHT is Zero) then Convert to String '99.999'.
Otherwise, use VWEIGHT to String as '99.999'
What I am seeing, is that:
If VWEIGHT is NOT calculated (default to zero), the result in WEIGHT$ from TAWEIGHT) is always '000000'.
If VWEIGHT is calculated and TAWEIGHT > VWEIGHT, then the same line of code will give me the proper WEIGHT$ as '99.999'
ELSE If TAWEIGHT NOT greater than VWEIGHT then WEIGHT$ is VWEIGHT as '99.999'
I tried setting VWEIGHT to a non-zero value be default and if no calculation of (L x W x H) then the WEIGHT$ from TAWEIGHT would still be '000000'
So, the same line of code, will work or not depending if an independent calculation is performed before or not...
I put debugging lines and can confirm this behavior.
Very Strange !!
I could provide the compile source, it is over 6,000 lines before clean-up. Would also need to provide test data (ouch!)
This program worked fine since 2003 and was converted to C32 in 2011.
Windows 7 x64, Comet 32 2018.515, UTL & REL 17.02...
Post a Followup
Each file can be a maximum of 1MB in length Uploaded files will be purged from the server on a regular basis.