Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OutPut data using VFP

Status
Not open for further replies.

Aaron247

Technical User
Apr 28, 2015
1
Hi i am relativly new to this,

However i am trying to find the best way to export a certain piece of data from my program.
I have managed to get the code to show me the total of what i would need. However i now need to try and pull this to screen as an FRX which will also ask me for a specific date when running.
Does anyone have any ideas?

ldStartDate=FDOM(DATE())
ldEndDate=LDOM(DATE())

SELECT 0
SELECT rdate,stock,.F. as lHighest FROM mstrvm ;
WHERE cBuild="****" .AND. BETWEEN(rdate,ldStartDate,ldEndDate) ;
INTO CURSOR tmpDays READWRITE
lnStockMax=0
LOCATE
SCAN WHILE !EOF()
IF stock>lnStockMax
lnStockMax=stock
ENDIF
ENDSCAN

LOCATE
SCAN FOR stock=lnStockMax WHILE !EOF()
REPLACE lHighest with .T.
ENDSCAN


BROWSE
 
You can design a report with report controls specifying alias.field or just field names, even if not making use of the report data environment. You can hardly preview this, but you can then do your code to prepar the report data and then simply REPORT FORM your.frx, which will take your cursor as data to print.

The only two requirements are: 1. The fieldnames match that of the cursor you generate seperate to the report befor you run it, and 2. the report works in the default datasession and doesn't have a private datasession.

Bye, Olaf.
 
An FRX cannot ask for a date - or anything else. An FRX is a report. What you need is a form. The form should contain a texbox where the user can enter the date (or two textboxes if you have a start and end date).

You then take Value property of the textbox(es), convert them to dates (using CTOD()), and then plug those values into your query, in place of your existing ldStartDate and ldEndDate.

Once you have done that, you can pass your cursor to an FRX, in order to display the information in a nicely-formatted report.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
What Mike says doesn't contradict what I said. You can do a form, you could also use inputvalue(), but I actually assumed your code already is part of a form and all you're asking for is how to replace the BROWSE with a report. In the simplest case your report only has controls in the detail band with expression set to the field names you see in your browse. Then you do REPORT FORM your.frx PREVIEW instead of browse and the report preview will show the data instead of the browse window, it's really that simple.

Bye, Olaf.


 
Yes, thanks.

Anyway Aaron uses functions FDOM(Date()) and LDOM(DATE()), which I assume compute First Day Of Month and Last Day Of Month, so in that case even no user interaction is needed.

Bye,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top