VFP 6 (Visual Foxpro 6) Error

Hi, I am trying to figure out what the correct syntax is to fix the error in the attached .jpg. I am using VFP6.

Thanks in advance,

Charlie VFP6 Error
cafulfordAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Olaf DoschkeSoftware DeveloperCommented:
You give the reason yourself: product.case_qty is a numeric field. You can't use alltrim() - which is a string function - on a numeric value.

While an N(5) field stores it's numeric values in string format in the dbf file, it is converted to numeric (double) in memory, so your if found() else endif is setting HoldThisSAPCaseQty to a numeric value in the if case and the string "FNF" in the else case.

You would need STR(product.case_qty) to make HoldThisSAPCaseQty a string in both cases.

Bye, Olaf.
0
cafulfordAuthor Commented:
Hi Olaf,

I was only trying to convert it to a string because I was not sure how to get it embedded in:
strLbl = strLbl + "^FO25,65^BY.33^B3N,N,30,N,N^FD" + AllTrim(HoldThisSAPCaseQty) + AllTrim(label.cust_prod) + "^FS" + CRLF

What is the syntax for adding that field into the statement if I want to keep it numeric?

Thanks,

Charlie
0
Olaf DoschkeSoftware DeveloperCommented:
You can't keep it numeric, as you want to add it into a string.
And Alltrim() does NOT convert to a string, it just trims a string, STR() converts to a string.

All I was already saying is you need to make this correction:

If Found()
   HoldThisSAPCaseQty = STR(product.case_qty)
Else
   HoldThisSAPCaseQty = "FNF"
Endif

I hope this makes it clearer.

Bye, Olaf.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pcelbaCommented:
You have to convert it to the string otherwise you cannot embed it into the string.

Simply do what Olaf suggested or use TRANSFORM function:

HoldThisSAPCaseQty = TRANSFORM(product.case_qty)

on appropriate place.
 
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
FoxPro

From novice to tech pro — start learning today.