Report Tags Clearing - Detailed clearing 
Author Message
 Report Tags Clearing - Detailed clearing

Hi,

I am posting the following code about cleaning Report Tags and I am seeking
for comments because I know that many of you are far more advanced users
than me. So I wanted to share my idea and check it if it's correct.

According to Microsoft:

* SUMMARY
* Microsoft Visual FoxPro developers sometimes want to distribute
* reports without the worry of possible differences between the printer
* information contained in the report and the printer on the system
* where the report is going to run. The example in this article uses the
* Visual FoxPro project hooks to reset printer-specific information
* within all the reports in a project.
*
* MORE INFORMATION
* When you save a report in Visual FoxPro, the printer driver
* information and other print options are stored in the report table. To
* avoid any discrepancies, clear the printer information stored in the
* report before you distribute the application. This information is
* stored in the TAG, TAG2, and EXPR fields of the report. If you clear
* these fields, Visual FoxPro uses the system default printer to output
* the report.
*
* NOTE: The EXPR field also contains information about printer
* orientation, number of desired copies, and so forth. If your
* environment requires you to keep these settings, you should not clear
* this field. To do this, remark the line that reads:
* Expr with cEmptyStr

According to the Note above, I thought that with a function someone could
just remove only the unwanted lines from the Expr.
So instead of  the simple (that clears entirely the Expr)

       Replace ;
        Tag with cEmptyStr, ;
        Tag2 with cEmptyStr, ;
        Expr with cEmptyStr

or (that keeps the Expr)

       Replace ;
        Tag with cEmptyStr, ;
        Tag2 with cEmptyStr

How about the following that removes only those lines really not needed:
       Replace ;
        Tag with cEmptyStr, ;
        Tag2 with cEmptyStr, ;
        Expr with Remove_From_Expr(Expr)

Where:
Function Remove_From_Expr
 #Define LFCR CHR(13)+Chr(10)

 Lparameters cExpr

 Local rmLines[4], n1, n2

 * Define the lines that you want to remove from the String
 rmLines[1]="DRIVER="
 rmLines[2]="DEVICE="
 rmLines[3]="OUTPUT="
 rmLines[4]="YRESOLUTION="

 cExpr=LFCR+cExpr+LFCR

 for i=1 to alen(rmLines)
  n1=At(LFCR+rmLines[i], cExpr)
  if n1>=1
   cTxt1=Left(cExpr, n1+1)
   cTxt2=Substr(cExpr, n1+2)
   n2=at(LFCR, cTxt2)
   if n2>0
    cTxt2=Substr(cTxt2, n2+2)
   Endif
   cExpr=cTxt1+cTxt2
  Endif
 Next
 cExpr=Substr(cExpr, 3, len(cExpr)-4)
 Return  cExpr

Do you think that I should remove more lines, or the above are enough?

Demetrios, Greece



Fri, 02 Sep 2005 10:22:23 GMT  
 Report Tags Clearing - Detailed clearing
Hi Russel,

My idea was not to remove all lines from the Expr as the attached abstract
from the KB suggested, because in that way I would loose the orientation (in
the case of landscape reports). If I let the info there to preserve
orientation then I would also keep the printer drivers also.
At this time I run the program that clears all reports of the project
manually. But I will try your suggestion. I have VFP 6. I hope that this
works.

Thanks

Demetrios, Greece


Quote:
> All I can say is that I use the attached project hook so that this happens
> when I build the program.  See the BeforeBuild method.  It is based on the
> VFP foundation classes, which you should have, so I didn't include them.



> > Hi,

> > I am posting the following code about cleaning Report Tags and I am
> seeking
> > for comments because I know that many of you are far more advanced users
> > than me. So I wanted to share my idea and check it if it's correct.

> > According to Microsoft:

> > * SUMMARY
> > * Microsoft Visual FoxPro developers sometimes want to distribute
> > * reports without the worry of possible differences between the printer
> > * information contained in the report and the printer on the system
> > * where the report is going to run. The example in this article uses the
> > * Visual FoxPro project hooks to reset printer-specific information
> > * within all the reports in a project.
> > *
> > * MORE INFORMATION
> > * When you save a report in Visual FoxPro, the printer driver
> > * information and other print options are stored in the report table. To
> > * avoid any discrepancies, clear the printer information stored in the
> > * report before you distribute the application. This information is
> > * stored in the TAG, TAG2, and EXPR fields of the report. If you clear
> > * these fields, Visual FoxPro uses the system default printer to output
> > * the report.
> > *
> > * NOTE: The EXPR field also contains information about printer
> > * orientation, number of desired copies, and so forth. If your
> > * environment requires you to keep these settings, you should not clear
> > * this field. To do this, remark the line that reads:
> > * Expr with cEmptyStr

> > According to the Note above, I thought that with a function someone
could
> > just remove only the unwanted lines from the Expr.
> > So instead of  the simple (that clears entirely the Expr)

> >        Replace ;
> >         Tag with cEmptyStr, ;
> >         Tag2 with cEmptyStr, ;
> >         Expr with cEmptyStr

> > or (that keeps the Expr)

> >        Replace ;
> >         Tag with cEmptyStr, ;
> >         Tag2 with cEmptyStr

> > How about the following that removes only those lines really not needed:
> >        Replace ;
> >         Tag with cEmptyStr, ;
> >         Tag2 with cEmptyStr, ;
> >         Expr with Remove_From_Expr(Expr)

> > Where:
> > Function Remove_From_Expr
> >  #Define LFCR CHR(13)+Chr(10)

> >  Lparameters cExpr

> >  Local rmLines[4], n1, n2

> >  * Define the lines that you want to remove from the String
> >  rmLines[1]="DRIVER="
> >  rmLines[2]="DEVICE="
> >  rmLines[3]="OUTPUT="
> >  rmLines[4]="YRESOLUTION="

> >  cExpr=LFCR+cExpr+LFCR

> >  for i=1 to alen(rmLines)
> >   n1=At(LFCR+rmLines[i], cExpr)
> >   if n1>=1
> >    cTxt1=Left(cExpr, n1+1)
> >    cTxt2=Substr(cExpr, n1+2)
> >    n2=at(LFCR, cTxt2)
> >    if n2>0
> >     cTxt2=Substr(cTxt2, n2+2)
> >    Endif
> >    cExpr=cTxt1+cTxt2
> >   Endif
> >  Next
> >  cExpr=Substr(cExpr, 3, len(cExpr)-4)
> >  Return  cExpr

> > Do you think that I should remove more lines, or the above are enough?

> > Demetrios, Greece



Sat, 03 Sep 2005 11:52:01 GMT  
 Report Tags Clearing - Detailed clearing
Yes, my code preserves orientation, but nothing else.  I could refine my
code, but it's working for me now, so it's not high on the priority list.


Quote:
> Hi Russel,

> My idea was not to remove all lines from the Expr as the attached abstract
> from the KB suggested, because in that way I would loose the orientation
(in
> the case of landscape reports). If I let the info there to preserve
> orientation then I would also keep the printer drivers also.
> At this time I run the program that clears all reports of the project
> manually. But I will try your suggestion. I have VFP 6. I hope that this
> works.

> Thanks

> Demetrios, Greece



> > All I can say is that I use the attached project hook so that this
happens
> > when I build the program.  See the BeforeBuild method.  It is based on
the
> > VFP foundation classes, which you should have, so I didn't include them.



> > > Hi,

> > > I am posting the following code about cleaning Report Tags and I am
> > seeking
> > > for comments because I know that many of you are far more advanced
users
> > > than me. So I wanted to share my idea and check it if it's correct.

> > > According to Microsoft:

> > > * SUMMARY
> > > * Microsoft Visual FoxPro developers sometimes want to distribute
> > > * reports without the worry of possible differences between the
printer
> > > * information contained in the report and the printer on the system
> > > * where the report is going to run. The example in this article uses
the
> > > * Visual FoxPro project hooks to reset printer-specific information
> > > * within all the reports in a project.
> > > *
> > > * MORE INFORMATION
> > > * When you save a report in Visual FoxPro, the printer driver
> > > * information and other print options are stored in the report table.
To
> > > * avoid any discrepancies, clear the printer information stored in the
> > > * report before you distribute the application. This information is
> > > * stored in the TAG, TAG2, and EXPR fields of the report. If you clear
> > > * these fields, Visual FoxPro uses the system default printer to
output
> > > * the report.
> > > *
> > > * NOTE: The EXPR field also contains information about printer
> > > * orientation, number of desired copies, and so forth. If your
> > > * environment requires you to keep these settings, you should not
clear
> > > * this field. To do this, remark the line that reads:
> > > * Expr with cEmptyStr

> > > According to the Note above, I thought that with a function someone
> could
> > > just remove only the unwanted lines from the Expr.
> > > So instead of  the simple (that clears entirely the Expr)

> > >        Replace ;
> > >         Tag with cEmptyStr, ;
> > >         Tag2 with cEmptyStr, ;
> > >         Expr with cEmptyStr

> > > or (that keeps the Expr)

> > >        Replace ;
> > >         Tag with cEmptyStr, ;
> > >         Tag2 with cEmptyStr

> > > How about the following that removes only those lines really not
needed:
> > >        Replace ;
> > >         Tag with cEmptyStr, ;
> > >         Tag2 with cEmptyStr, ;
> > >         Expr with Remove_From_Expr(Expr)

> > > Where:
> > > Function Remove_From_Expr
> > >  #Define LFCR CHR(13)+Chr(10)

> > >  Lparameters cExpr

> > >  Local rmLines[4], n1, n2

> > >  * Define the lines that you want to remove from the String
> > >  rmLines[1]="DRIVER="
> > >  rmLines[2]="DEVICE="
> > >  rmLines[3]="OUTPUT="
> > >  rmLines[4]="YRESOLUTION="

> > >  cExpr=LFCR+cExpr+LFCR

> > >  for i=1 to alen(rmLines)
> > >   n1=At(LFCR+rmLines[i], cExpr)
> > >   if n1>=1
> > >    cTxt1=Left(cExpr, n1+1)
> > >    cTxt2=Substr(cExpr, n1+2)
> > >    n2=at(LFCR, cTxt2)
> > >    if n2>0
> > >     cTxt2=Substr(cTxt2, n2+2)
> > >    Endif
> > >    cExpr=cTxt1+cTxt2
> > >   Endif
> > >  Next
> > >  cExpr=Substr(cExpr, 3, len(cExpr)-4)
> > >  Return  cExpr

> > > Do you think that I should remove more lines, or the above are enough?

> > > Demetrios, Greece



Sat, 03 Sep 2005 23:35:12 GMT  
 Report Tags Clearing - Detailed clearing
Hi Lee,

Thanks for your answer.
My idea was not to remove all lines from the Expr because the orientation
usually has to be there at least for those reports that are designed as
landscape.I will look at the article you suggested.
Thanks.

Demetrios, Greece


Quote:
> Hi Demetrios:

> The lines you need to remove from the EXPR field totally depend on what
you
> are trying to accomplish; therefore, the question "Do you think that I
> should remove more lines, or the above are enough?" is impossible to
> answer. Some developers need to remove all the information to use the
> default Windows printer driver along with its properties, and some need to
> remove everything except the Orientation line to print with the default
> printer driver in landscape mode.

> You need to identify the minimum number of properties that you want the
> report to have.  Then remove the unnecessary properties from the Expr
> field.

> I see you have written code to modify the Expr field.  This is fine.
> However, you might wnt to look at the technique we have in this article
and
> maybe you can get some more ideas on adding functionality to your code.

> 133163 HOWTO: Control Printer Attributes for a Report at Run Time
> http://support.microsoft.com/?id=133163

> I hope this helps.

> This posting is provided "AS IS" with no warranties, and confers no
rights.

> Sincerely,
> Microsoft FoxPro Technical Support
> Lee Mitchell

> >Hi,

> >I am posting the following code about cleaning Report Tags and I am
seeking
> >for comments because I know that many of you are far more advanced users
> >than me. So I wanted to share my idea and check it if it's correct.

> << KB information removed>>

> >According to the Note above, I thought that with a function someone could
> >just remove only the unwanted lines from the Expr.
> >So instead of  the simple (that clears entirely the Expr)

>   >     Replace ;
>    >     Tag with cEmptyStr, ;
>    >     Tag2 with cEmptyStr, ;
>    >     Expr with cEmptyStr

> >or (that keeps the Expr)

>   >     Replace ;
>    >     Tag with cEmptyStr, ;
>    >     Tag2 with cEmptyStr

> >How about the following that removes only those lines really not needed:
>    >    Replace ;
>    >     Tag with cEmptyStr, ;
>     >    Tag2 with cEmptyStr, ;
>     >    Expr with Remove_From_Expr(Expr)

> > Where:
> > Function Remove_From_Expr
> >  #Define LFCR CHR(13)+Chr(10)

> > Lparameters cExpr

> > Local rmLines[4], n1, n2

> > * Define the lines that you want to remove from the String
> > rmLines[1]="DRIVER="
> > rmLines[2]="DEVICE="
> > rmLines[3]="OUTPUT="
> > rmLines[4]="YRESOLUTION="

> > cExpr=LFCR+cExpr+LFCR

> > for i=1 to alen(rmLines)
> >  n1=At(LFCR+rmLines[i], cExpr)
> >  if n1>=1
>  >  cTxt1=Left(cExpr, n1+1)
>  >  cTxt2=Substr(cExpr, n1+2)
>  >  n2=at(LFCR, cTxt2)
> >   if n2>0
> >    cTxt2=Substr(cTxt2, n2+2)
>  >  Endif
>  >  cExpr=cTxt1+cTxt2
>  > Endif
> > Next
> > cExpr=Substr(cExpr, 3, len(cExpr)-4)
> > Return  cExpr

> > Do you think that I should remove more lines, or the above are enough?

> > Demetrios, Greece



Sat, 03 Sep 2005 11:47:07 GMT  
 Report Tags Clearing - Detailed clearing
Hi Lee,

Looking at the article, does this mean that you do not include reports in
the project, but you deliver them separately?

Demetrios, Greece


Quote:
> Hi Lee,

> Thanks for your answer.
> My idea was not to remove all lines from the Expr because the orientation
> usually has to be there at least for those reports that are designed as
> landscape.I will look at the article you suggested.
> Thanks.

> Demetrios, Greece



> > Hi Demetrios:

> > The lines you need to remove from the EXPR field totally depend on what
> you
> > are trying to accomplish; therefore, the question "Do you think that I
> > should remove more lines, or the above are enough?" is impossible to
> > answer. Some developers need to remove all the information to use the
> > default Windows printer driver along with its properties, and some need
to
> > remove everything except the Orientation line to print with the default
> > printer driver in landscape mode.

> > You need to identify the minimum number of properties that you want the
> > report to have.  Then remove the unnecessary properties from the Expr
> > field.

> > I see you have written code to modify the Expr field.  This is fine.
> > However, you might wnt to look at the technique we have in this article
> and
> > maybe you can get some more ideas on adding functionality to your code.

> > 133163 HOWTO: Control Printer Attributes for a Report at Run Time
> > http://support.microsoft.com/?id=133163

> > I hope this helps.

> > This posting is provided "AS IS" with no warranties, and confers no
> rights.

> > Sincerely,
> > Microsoft FoxPro Technical Support
> > Lee Mitchell

> > >Hi,

> > >I am posting the following code about cleaning Report Tags and I am
> seeking
> > >for comments because I know that many of you are far more advanced
users
> > >than me. So I wanted to share my idea and check it if it's correct.

> > << KB information removed>>

> > >According to the Note above, I thought that with a function someone
could
> > >just remove only the unwanted lines from the Expr.
> > >So instead of  the simple (that clears entirely the Expr)

> >   >     Replace ;
> >    >     Tag with cEmptyStr, ;
> >    >     Tag2 with cEmptyStr, ;
> >    >     Expr with cEmptyStr

> > >or (that keeps the Expr)

> >   >     Replace ;
> >    >     Tag with cEmptyStr, ;
> >    >     Tag2 with cEmptyStr

> > >How about the following that removes only those lines really not
needed:
> >    >    Replace ;
> >    >     Tag with cEmptyStr, ;
> >     >    Tag2 with cEmptyStr, ;
> >     >    Expr with Remove_From_Expr(Expr)

> > > Where:
> > > Function Remove_From_Expr
> > >  #Define LFCR CHR(13)+Chr(10)

> > > Lparameters cExpr

> > > Local rmLines[4], n1, n2

> > > * Define the lines that you want to remove from the String
> > > rmLines[1]="DRIVER="
> > > rmLines[2]="DEVICE="
> > > rmLines[3]="OUTPUT="
> > > rmLines[4]="YRESOLUTION="

> > > cExpr=LFCR+cExpr+LFCR

> > > for i=1 to alen(rmLines)
> > >  n1=At(LFCR+rmLines[i], cExpr)
> > >  if n1>=1
> >  >  cTxt1=Left(cExpr, n1+1)
> >  >  cTxt2=Substr(cExpr, n1+2)
> >  >  n2=at(LFCR, cTxt2)
> > >   if n2>0
> > >    cTxt2=Substr(cTxt2, n2+2)
> >  >  Endif
> >  >  cExpr=cTxt1+cTxt2
> >  > Endif
> > > Next
> > > cExpr=Substr(cExpr, 3, len(cExpr)-4)
> > > Return  cExpr

> > > Do you think that I should remove more lines, or the above are enough?

> > > Demetrios, Greece



Sat, 03 Sep 2005 15:20:12 GMT  
 Report Tags Clearing - Detailed clearing
Hello, Demetrios!
You wrote  on Tue, 18 Mar 2003 09:20:12 +0200:

 DP> Looking at the article, does this mean that you do not include reports
 DP> in the project, but you deliver them separately?

 DP> Demetrios, Greece

Sort of. To change the frx file contents, the frx/frt files need to be on
disk. This gives you two options:

- do not include the report files in your build
- include the report files in your build and save them on disk before you
run the code from the article. You can easily do this with the USE command:

SELECT 0
USE reportfile_inside_your_exe.frx
COPY TO copy_of_reportfile_on_disk.frx
USE copy_of_reportfile_on_disk.frx && personally, I'd copy this file to the
windows temp folder
* code from article goes here
REPORT FORM copy_of_reportfile_on_disk TO PRINTER
DELETE FILE "copy_of_reportfile_on_disk.frx" && do not make a mess of your
user's hard disk
---
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8



Sat, 03 Sep 2005 15:55:27 GMT  
 Report Tags Clearing - Detailed clearing
Eric,

COOL !!!!!!!!
I will try it.

Thanks.
Demetrios



Quote:
> Hello, Demetrios!
> You wrote  on Tue, 18 Mar 2003 09:20:12 +0200:

>  DP> Looking at the article, does this mean that you do not include
reports
>  DP> in the project, but you deliver them separately?

>  DP> Demetrios, Greece

> Sort of. To change the frx file contents, the frx/frt files need to be on
> disk. This gives you two options:

> - do not include the report files in your build
> - include the report files in your build and save them on disk before you
> run the code from the article. You can easily do this with the USE
command:

> SELECT 0
> USE reportfile_inside_your_exe.frx
> COPY TO copy_of_reportfile_on_disk.frx
> USE copy_of_reportfile_on_disk.frx && personally, I'd copy this file to
the
> windows temp folder
> * code from article goes here
> REPORT FORM copy_of_reportfile_on_disk TO PRINTER
> DELETE FILE "copy_of_reportfile_on_disk.frx" && do not make a mess of your
> user's hard disk
> ---
> Eric den Doop
> www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8



Sat, 03 Sep 2005 18:16:53 GMT  
 Report Tags Clearing - Detailed clearing
Yes, my code preserves orientation, but nothing else.  I could refine my
code, but it's working for me now, so it's not high on the priority list.


Quote:
> Hi Russel,

> My idea was not to remove all lines from the Expr as the attached abstract
> from the KB suggested, because in that way I would loose the orientation
(in
> the case of landscape reports). If I let the info there to preserve
> orientation then I would also keep the printer drivers also.
> At this time I run the program that clears all reports of the project
> manually. But I will try your suggestion. I have VFP 6. I hope that this
> works.

> Thanks

> Demetrios, Greece



> > All I can say is that I use the attached project hook so that this
happens
> > when I build the program.  See the BeforeBuild method.  It is based on
the
> > VFP foundation classes, which you should have, so I didn't include them.



> > > Hi,

> > > I am posting the following code about cleaning Report Tags and I am
> > seeking
> > > for comments because I know that many of you are far more advanced
users
> > > than me. So I wanted to share my idea and check it if it's correct.

> > > According to Microsoft:

> > > * SUMMARY
> > > * Microsoft Visual FoxPro developers sometimes want to distribute
> > > * reports without the worry of possible differences between the
printer
> > > * information contained in the report and the printer on the system
> > > * where the report is going to run. The example in this article uses
the
> > > * Visual FoxPro project hooks to reset printer-specific information
> > > * within all the reports in a project.
> > > *
> > > * MORE INFORMATION
> > > * When you save a report in Visual FoxPro, the printer driver
> > > * information and other print options are stored in the report table.
To
> > > * avoid any discrepancies, clear the printer information stored in the
> > > * report before you distribute the application. This information is
> > > * stored in the TAG, TAG2, and EXPR fields of the report. If you clear
> > > * these fields, Visual FoxPro uses the system default printer to
output
> > > * the report.
> > > *
> > > * NOTE: The EXPR field also contains information about printer
> > > * orientation, number of desired copies, and so forth. If your
> > > * environment requires you to keep these settings, you should not
clear
> > > * this field. To do this, remark the line that reads:
> > > * Expr with cEmptyStr

> > > According to the Note above, I thought that with a function someone
> could
> > > just remove only the unwanted lines from the Expr.
> > > So instead of  the simple (that clears entirely the Expr)

> > >        Replace ;
> > >         Tag with cEmptyStr, ;
> > >         Tag2 with cEmptyStr, ;
> > >         Expr with cEmptyStr

> > > or (that keeps the Expr)

> > >        Replace ;
> > >         Tag with cEmptyStr, ;
> > >         Tag2 with cEmptyStr

> > > How about the following that removes only those lines really not
needed:
> > >        Replace ;
> > >         Tag with cEmptyStr, ;
> > >         Tag2 with cEmptyStr, ;
> > >         Expr with Remove_From_Expr(Expr)

> > > Where:
> > > Function Remove_From_Expr
> > >  #Define LFCR CHR(13)+Chr(10)

> > >  Lparameters cExpr

> > >  Local rmLines[4], n1, n2

> > >  * Define the lines that you want to remove from the String
> > >  rmLines[1]="DRIVER="
> > >  rmLines[2]="DEVICE="
> > >  rmLines[3]="OUTPUT="
> > >  rmLines[4]="YRESOLUTION="

> > >  cExpr=LFCR+cExpr+LFCR

> > >  for i=1 to alen(rmLines)
> > >   n1=At(LFCR+rmLines[i], cExpr)
> > >   if n1>=1
> > >    cTxt1=Left(cExpr, n1+1)
> > >    cTxt2=Substr(cExpr, n1+2)
> > >    n2=at(LFCR, cTxt2)
> > >    if n2>0
> > >     cTxt2=Substr(cTxt2, n2+2)
> > >    Endif
> > >    cExpr=cTxt1+cTxt2
> > >   Endif
> > >  Next
> > >  cExpr=Substr(cExpr, 3, len(cExpr)-4)
> > >  Return  cExpr

> > > Do you think that I should remove more lines, or the above are enough?

> > > Demetrios, Greece



Sat, 03 Sep 2005 23:35:12 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Clear windows does not clear form in which a grid has focus

2. The reports are not clear

3. clearing report variables problem

4. FPW to VFP: CLEAR READ and the READ VALID clause

5. Clear text from textbox

6. clear lastkey()?

7. READ / CLEAR EVENTS

8. medical claims clearing house & foxpro

9. Clearing @ GET List Box in 7.0

10. how to clear a form using SetAll()

11. clear an array? FPW2.6

12. problem with CLEAR ALL

 

 
Powered by phpBB® Forum Software