Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Doing away with Private variables
Message
 
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
01685958
Message ID:
01685975
Views:
29
Likes (1)
>>>Hi,
>>>
>>>I have 2-band report. The 2nd band relies on records in a cursor. The cursor name is lcLaborCursor. The cursor is created as follows:
>>>
>>>lcLaborCursor = SYS(2015)
>>>
>>>So the variable lcLaborCursor has to be in scope when the report is produced. But the cursor (lcLaborCursor) is created and populated two functions before the report is produced. So, I declare the variable lcLaborCursor as PRIVATE. And it works.
>>>
>>>Another way I can do it is to declare the variable as Local (my desired goal) and then pass it from one function to another, and then to another.
>>>
>>>My question: Can I declare the variable lcLaborCursor LOCAL, not pass it from one function to another, but then still make the cursor in scope within the report?
>>>Some of the text in the report is using the following syntax:
>>>
>>>EVALUATE( lcLaborCursor + ."FLD_NAME")
>>>
>>>The above requires that the lcLaborCursor be in scope.
>>>
>>>What else can I do?
>>>
>>>TIA
>>
>>The most simple thing would be to use a static name like cur_Report_XYZ. It just depends on a good name (~ing convention) that creates the names. If a report is called by more more then one source procedure, well it's just the same cursor name.
>>
>>I, in general, normally do all stuff I need to determine the data and finally create an report curPrint[_nn] cursor just for the purpose of REPORT FORM. The _nn part is optional for reports with more then one source, or for reports chained.
>
>Thank you and Tamar for your constructive suggestions. I will review these carefully since I don't know where this cursor name is used. I will use GoFish to find out. And, knowing me, I may break something in the process. Especially when changing a variable name, and the EVALUATE() expression, to directly using the cursor.
>One little step at a time.

I wanted to add to my previous message. I just checked and I find that the band no 1 uses a static cursor name. The same cursor name (REPCURS) that I use in many, many reports. And nothing ever was broken. And yet, for the 2nd band I used a variable instead of the static cursor name. Inconsistent.
So, I know that if I take the time to change the report(s) and change the cursor variable to a static name, things should work.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform