Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FORM Designer as Reporting Tool. I had to try it.
Message
From
04/01/2002 03:16:25
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00598406
Message ID:
00600636
Views:
24
Hi Nadya

>Let me know, if you're interested.

Yes Please:)




>Hi Mark,
>
>Thanks for sharing. In the meantime I already contacted the author (Roman Verhovsky from Kharkov, Ukraine), he translated his work into English, I made few minor corrections in Readme.txt (he asked me about it) and he promised to publish, but has not yet sent the file. I also tested it on the sample scrollable form and it worked just fine. May be I can send you this file for test, while we're waiting for upload. Let me know, if you're interested.
>
>>Hi Nadya
>>
>>I wrote the the function I mentioned which makes the job of doing multi table fixed record length reports a little easier.
>>
>>Your friends code would prove a much btter solution to my problems though:)
>>
>>I have posted the function in here to aid anyone who has the same problems. Its very handy for putting small fixed lenghth tables in the report footer or header:)
>>
>>
>>
>>
>>
>>
>>* FUNCTION XFIELD
>>* Author Mark Young
>>* Params 
>>*       luRec   =   RecordNumber  or 'NEXT'
>>*       LuFld   =   Field Number or Field Nmae
>>*       lcAlias =   The table Alias (if it is not part of field name)
>>* This function is a variation on the VFP FIELD() function
>>* Very handy for displaying a small fixed lenght tables in the Report Footer without selecting them into an array.
>>* It is designed to help in reports that have a requirement for displaying 
>>* multiple small fixed record length tables. eg
>>* Months of the year.....days of the week....small lookup tables etc
>>* It accepts a virtual record number as the first parameter so a whole table can be used as an array instead of just the record.
>>* If instead of a record number the keyword 'NEXT' is sent then it assumes the next record is required.
>>* this makes it handy for reports because you can just paste the same expression in multiple time
>>* and you dont have to revisit each expression to increment the record number (tedious with several tables on the same page)
>>* it can be called in a varity of ways. For example with a table called MonthTot
>>
>>* XFIELD(1,2,'MONTHTOT') returns the contents of Field(2) for record 1
>>
>>* XFIELD(1,'MONTHTOT.AMOUNT') returns the contents of the MONTHTOT.AMOUNT field for record 1
>>
>>* XFIELD('NEXT','MONTHTOT.AMOUNT') returns the next record in the sequence (It must have been called with a record number at least once)
>>
>>* So the fields to print out all the monthtots would look like
>>
>>* XFIELD(1,'MONTHTOT.AMOUNT') && must provide the starting record number
>>* XFIELD('NEXT','MONTHTOT.AMOUNT')
>>* XFIELD('NEXT','MONTHTOT.AMOUNT')
>>* XFIELD('NEXT','MONTHTOT.AMOUNT')  && now we just paste the same expression into report multiple times
>>* XFIELD('NEXT','MONTHTOT.AMOUNT')  && much easier and less error prone than incrementing all those counters by hand
>>* XFIELD('NEXT','MONTHTOT.AMOUNT')  && And we saved ourselves the earlier step of creating an array
>>* XFIELD('NEXT','MONTHTOT.AMOUNT')
>>* XFIELD('NEXT','MONTHTOT.AMOUNT')
>>* XFIELD('NEXT','MONTHTOT.AMOUNT')
>>* XFIELD('NEXT','MONTHTOT.AMOUNT')
>>* XFIELD('NEXT','MONTHTOT.AMOUNT')
>>* XFIELD('NEXT','MONTHTOT.AMOUNT')
>>
>>
>>
>>Function xfield
>>Lparameters luRec,luFld,lcAlias
>>LOCAL liPcount,liArea
>>liPcount=pcount()
>>liArea=Select()
>>If Vartype(luFld)='C' And '.'$luFld && ALias has been sent as part of field name
>>	lcAlias=Juststem(luFld)
>>	luFld=Justext(luFld)
>>Else
>>	If liPcount>		Error 'Alias must be part of field name or included as 3rd parameter'
>>	Endif
>>Endif
>>If Vartype(luFld)='N'
>>	luFld=Field(luFld,lcAlias)
>>Endif
>>lcCounter='___'+luFld
>>Select (lcAlias)
>>Go Top
>>If Vartype(luRec)='C' And Upper(luRec)='NEXT'
>>	Store eval(lcCounter)+1 To luRec
>>	Store luRec To (lcCounter)
>>Else
>>	Release (lcCounter)
>>	Public (lcCounter)
>>	Store luRec To (lcCounter)
>>Endif
>>
>>Skip luRec-1 && use this method instead of GOTO so routine works with filtered tables
>>
>>luRetval=Evaluate(luFld)
>>Select (liArea)
>>Return luRetval
>>
>>
>>
>>>Hi Mark,
>>>
>>>Recently in Russian VFP Club forum the same problem was discussed. Nataly, who was working on it, finally came out to a solution and posted it on this forum. Unfortunately, I'm afraid, the comments would be in Russian. I can ask her to send me this solution and may be translate comments into English. Or may be she can post it here in Download section. It may take couple of days, if she would agree, of course.
>>>
>>>>In order to overcome some of the limitations of the Report designer I did some lateral thinking and decided to use the Form Designer with Steven R Ruhl's form printing program.
>>>>
>>>>Let me explain my problem.
>>>>
>>>>I often have to produce reports that must display a variety of small tables all on the one page. Some next to each other, some underneath each other. As we all know VFP does not allow sub reporting zones.
>>>>
>>>>These tables usually have a fixed number of records so in the past I have created them in a couple of different ways as follows.
>>>>
>>>>1. Concatanate all the records/fields into a memo field with a chr(13) at the end of each record and place the memo field anywhere I want in the report designer. Nice and easy but need to use fixed width fonts and cant draw lines in between the records and fields
>>>>
>>>>2. Scatter everything into one large array and place each element in the array where I want it in report designer (can draw lines around things this way, but boy is it tedious)
>>>>
>>>>3. A variety of strange manipulations with select statements and print when in report designer (UGH!)
>>>>
>>>>4. Using @SAY :(
>>>>
>>>>After ruling out external progs such as Crystal Reports ,Excel and Fineprint I decided there must be a way to do this in straight VFP
>>>>
>>>>Since Steven R Ruhl's form printing/capture class make printing a form easy I decided to create a blank form and drop a few grids on it set all the properties so that the form and grids look like a printout (white backgrounds) and then print out the form.
>>>>
>>>>This almost worked
>>>>Trouble is the class only wants to print the part of the form that is visible in the desktop viewing port. Any part of the form that ends up off the desktop does not get printed.
>>>>
>>>>I can do the report in 2 halves each of 800 x 600 using capture instead of print and then print the 2 halfs as images in a normal report but since I wanted to turn this technique into a form based class that others can use just by dropping some grids and labels onto, everything starts to look too fiddly.
>>>>
>>>>Also I had hoped to do all this in the background but it seems the form has to be visible for printing or capture anything to happen (yes I know).
>>>>
>>>>This could be a very useful feature if someone can get past these limitations since it would be possible to produce some very fancy (though limited) reports using this method. Maybe even something fancier would be possible with reporting style grid classes resizing to fit their number of records (I dont want to go there myself)
>>>>
>>>>All help gratefully received.
>>>>Or maybe just write it for me since I am getting a bit fed up with the idea
Previous
Reply
Map
View

Click here to load this message in the networking platform