Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to fix REPORT TO ASCII bug (using frx2word?)
Message
 
 
To
14/01/2003 12:37:07
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00740915
Message ID:
00741548
Views:
21
>Thank you.
>
>This is nice idea.
>Unfortunately I cannot use this for the following reasons:
>
>1. I have groups in reports and summary calculations
>2. I have report variables in reports.
>

Right. As I said, the manual fix is required after this simple program is generated...
Here is the story of this program. I had R&R reports for Galley. The output had to be ASCII.
I originally designed these as reports (and spent about a day designing reports). Then I found out, that ASCII doesn't look right. I spent about 2 days trying to make it work, but since it didn't, I developed this program. Using my simple program I created a prototype, which I then manually adjusted to create a real working program like:
********************************************************************
*  Description.......: GalleyCreditRpt - Special program to produce MA Galley Credit Report
*  Calling Samples...: GalleyCreditRpt(oJC.outTable)
*  Parameter List....: tcTableName
*  Created by........: Nadya Nosonovsky 12/26/2000 04:38:15 PM
*  Modified by.......: Nadya Nosonovsky 05/22/2002 02:50:29 PM
********************************************************************
lparameters tcTableName
wait window nowait "Wait while Output file is generating..."
if empty(m.tcTableName)
	tcTableName="\Redp\Output\Galley\GalleyMA0008Tstr" && For tests only
endif
local lcStr, lcDBFName, lcFileName, lnOldSelect, lcRegistry, ;
	lcCity, llFirstTime, lcMiscType, lcOldCentury
set seconds off && AP 12/6/01  For date time function, don't print the seconds.
lnOldSelect=select()
lcDBFName=forceext(m.tcTableName,"dbf")
lcFileName=forceext(m.tcTableName,"crd") && Credit output file type
if file(m.lcFileName)
	erase (m.lcFileName)
endif
if !UseTble(m.lcDBFName,"WorkTable","shared noupdate","MABACK") && Assume it opens just fine
   return .f.
endif   
select WorkTable
if vartype(oJC)="O"
   oJC.extension='.crd'  && NSL 030601 added new property to allow special to set the file extension to the output module
   oJC.StepRecCount=reccount()
endif   
if reccount("WorkTable")=0
	use in WorkTable
	select (m.lnOldSelect)
	wait window nowait "No records to produce an output..."
	return 
endif
local TABC, CRLF
CRLF = chr(13)+chr(10)
TABC = chr(9)

lcOldCentury=set('century')
set century off && Display date in short format
go top
lcRegistry=Registry
lcCity=City
llFirstTime=.t.
lcMiscType=MiscType
lcStr=''
local prComma, prTaxLbl, prTaxType2, prAmtLbl, BkPgLC, DefendComb, Def1Alias
scan
****** Header section ******************
    if m.lcMiscType<>MiscType or m.llFirstTime && MiscType group Header
		lcStr=m.lcStr+trim(descrip)+CRLF && MiscType.FullName
		lcMiscType=m.lcMiscType
	endif

	if m.lcRegistry<>Registry or m.llFirstTime && Registry group Header
		lcStr=m.lcStr+'@Credit Registry:'+ ;
		      iif(empty(Registry),"No registry is given",trim(Registry))+CRLF
		lcRegistry=Registry
	endif
	if m.lcCity<>City or m.llFirstTime && City group Header
		lcStr=m.lcStr+"@Credit Town:"+iif(empty(City),"No town is given",trim(City))+CRLF
		lcCity=City		
	endif	

	llFirstTime=.f. && Now it's not a first time (all Headers are already printed)

***** Proceed with detail band
	prComma=iif(upper(left(Street,3))="ZZZ","",", ")
	DefendComb=trim(trim(PropDef1NM)+ iif(!empty(Def1Alias)," "+Def1Alias,'')+trim(Def2))
	prTaxLbl=iif(!empty(TaxType1)," Tax:","") && for Tax Liens
	prTaxLbl2=iif(!empty(TaxType1)," Type:","") && for Liens/Attachments
	prTaxType2=iif(!empty(TaxType2),", "+trim(TaxType2),"")
	prAmtLbl=iif(price>0," Amt:","")
	if empty(DocketRef)
		BkPgLC=""
	else
		if "/" $ DocketRef
			BkPgLC=" Bk/pg:"
		else
			BkPgLC=" Doc#:"
		endif
	endif

	do case
	case MiscType="VB"
		lcStr=m.lcStr+'@Voluntary:'+ rtrim(DefendComb)+ ;
			prComma+trim(Address)+", "+trim(City)+trim(prntZip)+ ;
			" D:"+dtoc(InitDate)+" "+"Case#: "+DocketRef+CRLF

	case MiscType="11"
		lcStr=m.lcStr+'@Chapter 11:'+ rtrim(DefendComb)+ ;
			prComma+trim(Address)+", "+trim(City)+trim(prntZip)+ ;
			" D:"+dtoc(InitDate)+" "+"Case#: "+DocketRef+CRLF

	case MiscType="13"
		lcStr=m.lcStr+'@Chapter 13:'+ rtrim(DefendComb)+ ;
			prComma+trim(Address)+", "+trim(City)+trim(prntZip)+ ;
			" D:"+dtoc(InitDate)+" "+"Case#: "+DocketRef+CRLF

	case MiscType="DH"
		lcStr=m.lcStr+'@Declarations:'+ ;
			trim(PropDef1Nm)+ trim(Def2)+ ;
			prComma+trim(Address)+", "+trim(City)+ ;
			" D:"+dtoc(InitDate)+CRLF

	case MiscType="FT"
		lcStr=m.lcStr+'@Fed Tax Liens:'+ rtrim(DefendComb)+ ;
			prComma+trim(Address)+", "+trim(City)+trim(prntZip)+ ;
			" D:"+dtoc(InitDate)+ ;
			prTaxLbl+trim(TaxType1)+prTaxType2+ ;
			prAmtLbl+alltrim(transform(price,'@Z$ 999,999,999'))+CRLF

	case MiscType="ST"
		lcStr=m.lcStr+'@Stt Tax Liens:'+ rtrim(DefendComb)+ ;
			prComma+trim(Address)+", "+trim(City)+trim(prntZip)+ ;
			" D:"+ dtoc(InitDate)+ ;
			prTaxLbl+trim(TaxType1)+prTaxType2+ ;
			prAmtLbl+alltrim(transform(price,'@Z$ 999,999,999'))+CRLF

	case MiscType="LA"
		lcStr=m.lcStr+'@Attachments:'+ rtrim(DefendComb)+ ;
			prComma+trim(Address)+", "+trim(City)+trim(prPlaint1)+ ;
			rtrim(prPlaint2)+prTaxLbl2+trim(TaxType1)+prTaxType2+" D:"+dtoc(InitDate)+ ;
			prAmtLbl+alltrim(transform(price,'@Z$ 999,999,999'))+CRLF

	case MiscType="EX"
		lcStr=m.lcStr+'@Executions:'+ rtrim(DefendComb)+ ;
			prComma+trim(Address)+", "+trim(City)+trim(prPlaint1)+ ;
			rtrim(prPlaint2)+" D:"+dtoc(InitDate)+ ;
			prAmtLbl+alltrim(transform(price,'@Z$ 999,999,999'))+CRLF

******** Lis Pendens ***************
	case MiscType="LP"
		lcStr=m.lcStr+'@Lis Pendens:'+ rtrim(DefendComb)+ ;
			prComma+trim(Address)+", "+trim(City)+trim(prPlaint1)+ ;
			rtrim(prPlaint2)+" D:"+dtoc(InitDate)+ ;
			prAmtLbl+alltrim(transform(price,'@Z$ 999,999,999'))+CRLF

****** Petitions ***************
	case MiscType="PF"
		lcStr=m.lcStr+'@Pet 1st Line:'+ trim(Address)+CRLF

		if empty(Def2)
			lcStr=m.lcStr+'@Petitions:Owner:'+ ;
				trim(Def1Name)+ " L:"+trim(Plaintiff1)+CRLF
		endif
		if !empty(Def2)
			lcStr=m.lcStr+'@Petitions:Owner:'+ ;
				trim(Def1Name)+ trim(Def2)+CRLF
			lcStr=lcStr+'@Petitions:Lender:'+ ;
				trim(Plaintiff1)+ trim(prPlaint2)+CRLF
		endif

		lcStr=m.lcStr+'@Petitions:'+ BkPgLC+ trim(DocketRef)+" "+ ;
			iif(RespDate>date(1980,1,1),"Respond by:","")+dtoc(RespDate)+CRLF
		lcStr=m.lcStr+'@Petitions:Source:'+ trim(NewsPName)+" ("+dtoc(PubDate)+")"+CRLF

****** Foreclosures ***********
	case MiscType="FS"
		lcStr=m.lcStr+'@Fore 1st Line:'+ ttoc(SaleDateTm)+" "+trim(Address)+CRLF
		lcStr=m.lcStr+'@Foreclosures:Owner:'+ trim(Def1Name)+trim(Def2)+ ;
			" "+trim(Alias1Type)+" "+trim(Alias1)+ CRLF
		lcStr=m.lcStr+'@Foreclosures:Lender:'+ trim(Plaintiff1)+trim(prPlaint2)+ ;
			iif(Deposit>0," Deposit:","")+alltrim(transform(Deposit,'@Z$ 999,999,999'))+ CRLF
		lcStr=m.lcStr+'@Foreclosures:'+ ltrim(BkPgLC)+trim(DocketRef)+ ;
			" D:"+dtoc(OrigMortg)+ CRLF
		lcStr=m.lcStr+'@Foreclosures:Source:'+ trim(NewsPName)+" ("+dtoc(PubDate)+")"+CRLF
		lcStr=m.lcStr+'@Foreclosures:'+ iif(!empty(Sheratty),"Atty:","")+trim(Sheratty)+" "+ ;
			Phone+CRLF

****** Sheriff ***********
	case MiscType="SS"
		lcStr=m.lcStr+'@Sher 1st Line:'+ trim(Address)+CRLF
		lcStr=m.lcStr+'@Sheriff:Sale at:'+ trim(SaleLoc)+", "+ ;
			ttoc(SaleDateTm)+CRLF
		lcStr=m.lcStr+'@Sheriff:Owner:'+ trim(Def1Name)+trim(Def2)+ ;
			" "+trim(Alias1Type)+" "+trim(Alias1)+ " "+BkPgLC+trim(DocketRef)+CRLF
		lcStr=m.lcStr+'@Sheriff:Source:'+ trim(NewsPName)+" ("+dtoc(PubDate)+")"+CRLF
	endcase
	if len(m.lcStr)>16770000 && Large file
		=strtofile(m.lcStr,m.lcFileName,.t.)
		lcStr='' && Start again
	endif
endscan
=strtofile(m.lcStr,m.lcFileName,.t.)
use in WorkTable
select (m.lnOldSelect) && Return back
if m.lcOldCentury='ON'
	set century on
endif
wait clear
return .t.
I don't remember right now, if this one was a converted report or I used already developed program for another report and created this one from scratch without report at all...


>This program does not handle those cases and caanot be modified easily to handle them.
>
>Btw. Is it possible to use your program to remove detail lines programmaticaly from report ?
>
>I need to remove detail lines manually becauses REPORT NOWAIT SUMMARY prints detail lines also.

In summary you're usually printing totals... You have to exclude scan, but you would need some totaling functions instead...
>
>Also, is'nt it better to convert report to a prg using \ or
>TEXT ... TEXTMERGE commands ?
>Resulting code seems to be more readable in this case.

Agree, but I'm using VFP6. Also for some reason I'm not using this very helpful command in my applications. I don't know, why. Sort of bad habit...
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform