Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can report create own data source
Message
From
21/06/2001 15:18:27
 
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00522062
Message ID:
00522120
Views:
9
>
>Thinking that I can build a report that calls a procedure to create the data source and then all the fields on the report use that data source. So I need to get it all done with a frx, frt, and a fxp (I will sneak the fxp into the folder). I assume this is possible, is it? Any tips on how to get it done or any other ideas?
>
>Hope this makes some sense
>
>Brenda

Well, this is kludgy, but it could work...

Create a program file:
*  createDataSource.prg
lparameters llOnOffSwitch
public myFlag

if llOnOffSwitch
    if !(myFlag)
        && create your datafile or cursor here....
	myFlag = .t.
    endif
else
    myFlag = .f.
    release myFlag
endif
return ''
In the detail band of your report, add a field containing createDataSource(.t.). In the summary band of the report, add a field containing createDataSource(.f.). If you don't do this, they will not be able to print the report again until they leave the application and come back in.

The createDataSource(.t.) (in detail band) might need to be the FIRST field added to the report...if the report tries to print a field before this one there will be no data...it will CRASH!

Be careful to give 'myFlag' a unique name so it doesn't conflict with something elsewhere (there shouldn't be global variables elsewhere anyway). I didn't fully test the llOnOffSwitch logic, but it should be close.

Also, there must be a table or cursor selected before the report is run. It can be any table or cursor, I suppose.

This is like using bubblegum to keep your car engine running. Hopefully it will work for you.
Steve Gibson
Previous
Reply
Map
View

Click here to load this message in the networking platform