Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
PRIVATE vs Hard-coding cursor name
Message
From
15/03/2019 05:18:15
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01667233
Message ID:
01667253
Views:
62
>Hi,
>
>I have a function that uses XFRX to convert a report to a PDF format.
>
>The report to be converted to PDF has multiple bands. XFRX handle it fine but the cursor names that are used for the bands have to be in scope inside the MyXFRX() function. And I used local variable. For example:
>
>local  Band1Cursor, Band2Cursor
>Band1Cursor = sys(2015)
>Band2Cursor = sys(2015)
>
>
>With the above scenario the MyXFRX function gives an error that variable Band1Cursor does not exist.
>
>The solution - so far - is to either make the variables Private or hard coded. That is, do not use variables but instead use names like CUR_Band1, CUR_band2
>
>Which approach would be a better practice?
>
>TIA

You are saying "have to be in scope inside MyXRFX() function". Any variable declared as LOCAL or PRIVATE, inside that function would be in scope of that function. So using LOCAL is fine. The error you are getting doesn't make sense.

Also, I think hard coding a cursor name is always fine. Cursor names are private to the data session that they are created in and their file names are sys(2015) values implicitly.
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform