Clear content/data from a CRVIEWER object ? 
Author Message
 Clear content/data from a CRVIEWER object ?

How can I clear the content of a CRVIEWER object ?

The following code didn't work:

    rs.Delete                                        'delete all records
    m_Report.DiscardSavedData            'should remove data from report
    CRViewer1.Refresh

#  rs As rdoResultset                     used by  m_Report
#  m_Report As CRAXDRT.Report

When I put new data to the "m_Report" it will be appended in the CRVIEWER1,
instead of being deleted.



Mon, 07 Mar 2005 16:33:59 GMT  
 Clear content/data from a CRVIEWER object ?
If you can Refresh method of the viewer object, you don't need to call
DiscardSavedData method on the report object. This is assuming your CRViewer
screen is already open.

If you are showing the report for the first time, after calling
DiscardSavedData, you should Call ViewReport method on the CRViewer object
instead.


Quote:
> How can I clear the content of a CRVIEWER object ?

> The following code didn't work:

>     rs.Delete                                        'delete all records
>     m_Report.DiscardSavedData            'should remove data from report
>     CRViewer1.Refresh

> #  rs As rdoResultset                     used by  m_Report
> #  m_Report As CRAXDRT.Report

> When I put new data to the "m_Report" it will be appended in the
CRVIEWER1,
> instead of being deleted.



Mon, 07 Mar 2005 17:14:41 GMT  
 Clear content/data from a CRVIEWER object ?
Thanks, but that didn't solve my problem of erasing the CRVIEWER1 content,
data gets appended, the old content isn't deleted.


Quote:
> If you can Refresh method of the viewer object, you don't need to call
> DiscardSavedData method on the report object. This is assuming your
CRViewer
> screen is already open.

> >     rs.Delete                                        'delete all records
> >     m_Report.DiscardSavedData            'should remove data from report
> >     CRViewer1.Refresh

> > #  rs As rdoResultset                     used by  m_Report
> > #  m_Report As CRAXDRT.Report

> > When I put new data to the "m_Report" it will be appended in the
> CRVIEWER1, instead of being deleted.>



Mon, 07 Mar 2005 17:33:00 GMT  
 Clear content/data from a CRVIEWER object ?
Why are you so sure that old data should be deleted?

Without knowing how your report is designed, I am going out on a limb to say
that what you consider "old" data may not be old as far as CR is concerned.


Quote:
> Thanks, but that didn't solve my problem of erasing the CRVIEWER1 content,
> data gets appended, the old content isn't deleted.



> > If you can Refresh method of the viewer object, you don't need to call
> > DiscardSavedData method on the report object. This is assuming your
> CRViewer
> > screen is already open.

> > >     rs.Delete                                        'delete all
records
> > >     m_Report.DiscardSavedData            'should remove data from
report
> > >     CRViewer1.Refresh

> > > #  rs As rdoResultset                     used by  m_Report
> > > #  m_Report As CRAXDRT.Report

> > > When I put new data to the "m_Report" it will be appended in the
> > CRVIEWER1, instead of being deleted.>



Mon, 07 Mar 2005 18:13:31 GMT  
 Clear content/data from a CRVIEWER object ?
I have an VB application that allows an user to view Triggers/Stored
Procedures/Tables/Indices/Views
from a connected SQL-Server; it is possible to view all or only a part (eg.
Triggers only).

Everytime the user clicks on "Show" the content of the report should be new
created,
so that if before "Triggers" were shown, eg now only Tables should be
displayed.

So how can i delete the "old" content? Setting the m_report to "nothing" and
recreating
it ? At the moment the new data is appended to the already existing content.

regards,
 d. aumueller


Quote:
> Why are you so sure that old data should be deleted?

> Without knowing how your report is designed, I am going out on a limb to
say
> that what you consider "old" data may not be old as far as CR is
concerned.



Mon, 07 Mar 2005 18:27:38 GMT  
 Clear content/data from a CRVIEWER object ?
Which table are you basing your report on? SysObjects?

Let's assume that you are using SysObjects. If you only want to show
triggers, then you would change the RecordSelectionFormula, to something
like {SysObjects.Type}="TR", and then call Refresh method on the CRViewer
object.


Quote:
> I have an VB application that allows an user to view Triggers/Stored
> Procedures/Tables/Indices/Views
> from a connected SQL-Server; it is possible to view all or only a part
(eg.
> Triggers only).

> Everytime the user clicks on "Show" the content of the report should be
new
> created,
> so that if before "Triggers" were shown, eg now only Tables should be
> displayed.

> So how can i delete the "old" content? Setting the m_report to "nothing"
and
> recreating
> it ? At the moment the new data is appended to the already existing
content.

> regards,
>  d. aumueller



> > Why are you so sure that old data should be deleted?

> > Without knowing how your report is designed, I am going out on a limb to
> say
> > that what you consider "old" data may not be old as far as CR is
> concerned.



Mon, 07 Mar 2005 18:48:50 GMT  
 Clear content/data from a CRVIEWER object ?
I use the "sp_table <tablename>"  stored procedure from SQL-Server:

  .CRViewer1.ReportSource = m_Report
   ....
   StrSQL = "sp_helptrigger '" + DB_Table + "'"                 // Stored
Proc.
   Set ps = cn.CreatePreparedStatement("", StrSQL)        // cn =
RDOconnection
   Set rs = ps.OpenResultset(rdOpenStatic)                    // rs =
resultset
   ....
  While Not rs.EOF                                                        //
read complete records
           .....
           With m_Report.Sections(1)
                str = CStr(rs.rdoColumns.Item("trigger_name"))        //
read entry "trigger_name" from Recordset
                Set txt1 = .AddTextObject(str, 0, y_pos)                //
display entry on CRviewer Report
  ....
   CRViewer1.refresh
   CRViewer1.ViewReport                  // show report

--denis


Quote:
> Which table are you basing your report on? SysObjects?

> Let's assume that you are using SysObjects. If you only want to show
> triggers, then you would change the RecordSelectionFormula, to something
> like {SysObjects.Type}="TR", and then call Refresh method on the CRViewer
> object.



Mon, 07 Mar 2005 21:04:50 GMT  
 Clear content/data from a CRVIEWER object ?
(1) You are dynamically adding Text fields to the report, not data. Thus,
calling DiscardSavedData won't clear those text fields you have added. The
operative word here is Data.

(2) If you want to clear those text fields, you have to call DeleteObject
method. That basically means that you need to go through each object in the
section, and determine if they are the ones you have added, and if they are,
you need to delete them. Quite a lot of code is required to do it. But it's
doable.

(3) Why don't you base your report on SysObjects and SysDepends tables (or
possibly a number of other system tables that are available)? Instead of
adding text fields dynamically, you can use CR as a database retrieval
system, and reporting tool, the way it is intended to be used.


Quote:
> I use the "sp_table <tablename>"  stored procedure from SQL-Server:

>   .CRViewer1.ReportSource = m_Report
>    ....
>    StrSQL = "sp_helptrigger '" + DB_Table + "'"                 // Stored
> Proc.
>    Set ps = cn.CreatePreparedStatement("", StrSQL)        // cn =
> RDOconnection
>    Set rs = ps.OpenResultset(rdOpenStatic)                    // rs =
> resultset
>    ....
>   While Not rs.EOF
//
> read complete records
>            .....
>            With m_Report.Sections(1)
>                 str = CStr(rs.rdoColumns.Item("trigger_name"))        //
> read entry "trigger_name" from Recordset
>                 Set txt1 = .AddTextObject(str, 0, y_pos)                //
> display entry on CRviewer Report
>   ....
>    CRViewer1.refresh
>    CRViewer1.ViewReport                  // show report

> --denis



> > Which table are you basing your report on? SysObjects?

> > Let's assume that you are using SysObjects. If you only want to show
> > triggers, then you would change the RecordSelectionFormula, to something
> > like {SysObjects.Type}="TR", and then call Refresh method on the
CRViewer
> > object.



Mon, 07 Mar 2005 21:29:58 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. setting formula contents in ActiveX designer / CRViewer

2. Clearing table contents within code

3. Clearing the Clipboard Contents

4. Clearing contents of bookmark

5. How to clear a specific cells contents using VBA

6. Clear all contents of clipboard

7. How to clear/copy the contents of a TreeView

8. How can i clear the MSHFLEXGRID without CLEAR - Como limpar a GRID sem usar CLEAR

9. How to clear the DBGrid contents

10. Clearing contents of a table

11. Clearing the contents of the grid control...

12. How do I clear contents of ComboBo in VB.Net

 

 
Powered by phpBB® Forum Software