Search:

Sites

CC Pivot Free 1.0

Getting Started

Using CC Pivot Free

Upgrade to Full Version

Modifications

DontSavePivotData

There may be times when you do not want to save the pivot data which CC Pivot normally saves each time a pivot is saved.

Before providing a way to do this, one caveat. One of the main reasons we store the data is so we can display the pivot table for the iOS. Since the iOS has neither the processing power nor the plugin support to generate the pivot data needed, we store it on the desktop platform allowing iPad clients to at lease browse previously generated pivot tables. That said I believe the best way to do what you are looking to do would be to make a slight change to two scripts:

	CC Pivot -> models -> stored pivot -> m.pivot.insert 
	CC Pivot -> models -> stored pivot -> m.pivot.update

In these two scripts towards the beginning we set the variable $html with a value. Comment out the entire calculation and set it to "". That should cause the data to not be stored.

When you do that, the system is going to think that the pivot needs saved even when it does not, because it assumes that you want the html to be saved (it compares the current html against the stored html as part of the check to see if the pivot needs saved). To fix that requires changing 3 calculations (1 field, 1 custom formatting, and 1 script step).

They are:

field: CCP.StoredPivot::unsaved_c calculation (change to below):

Let ([ update_flag = Let ([

 slicers = List ( CCP.SlicerFields::field_for_sql_c );
 data = List ( CCP.DataFields::field_for_sql_c );
 plu = CCP.Pivot::pivot_last_used

];

 If ( not IsEmpty ( slicers ) and not IsEmpty ( data ) and not IsEmpty ( plu ) ;

   Let ([
     slicer_obj = Substitute ( List ( CCP.SlicerFields::_object_c ) ;  ; "" ) & CC_Dict("Ids" ; List ( CCP.SlicerFields::_record_id_c ) ); 
     data_obj = Substitute ( List ( CCP.DataFields::_object_c ) ;  ; "" ) & CC_Dict("Ids" ; List ( CCP.DataFields::_record_id_c ) ); 
     filter_obj = Substitute ( List ( CCP.FilterFields::_object_c ) ;  ; "" ) & CC_Dict("Ids" ; List ( CCP.FilterFields::_record_id_c ) );
     is = CCP.Pivot::pivot_includeSummaries
   ];
      Case ( 
         CC_DictGet ( plu ; "slicers" ) ≠ slicer_obj ; 1 ;
         CC_DictGet ( plu ; "datas" ) ≠ data_obj ; 1 ;
         CC_DictGet ( plu ; "filters" ) ≠ filter_obj ; 1 ;
         CC_DictGet ( plu ; "summaries" ) ≠ is ; 1 ;
         0
      )
   ) ;
  0
 )

); saved_flag = If ( IsEmpty ( CCP.Pivot::pivot_id ) ; 1 ;

  Let ([
   fn = Substitute ( GetFieldName ( CCP.StoredPivot::html ); "::" ;  );
   id = GetValue ( Substitute ( GetFieldName ( CCP.StoredPivot::id ) ; "::" ;  ) ; 2 );
   table = GetValue ( Substitute ( GetFieldName ( CCP.StoredPivot::table ) ; "::" ;  ) ; 2 );
   title = GetValue ( Substitute ( GetFieldName ( CCP.StoredPivot::title ) ; "::" ;  ) ; 2 );
   style = GetValue ( Substitute ( GetFieldName ( CCP.StoredPivot::style_id ) ; "::" ;  ) ; 2 );
   sql = "SELECT \"" & GetValue ( fn ; 2 ) & "\", \"" & table & "\", \"" & title & "\", \"" & style & "\" FROM \"" & GetValue ( fn ; 1 ) & "\" WHERE \"" & id & "\"='" & CCP.Pivot::pivot_id & "'";
   results = _CC.fnSQL ( sql ; "" ; "" ) 
  ];
  //CCP.Pivot::pivot_html_table ≠ Substitute ( GetValue ( results ; 1 ) ; "\n" ;  ) or 
  CCP.Pivot::pivot_table ≠ GetValue ( results ; 2 ) or CCP.Pivot::pivot_css_table_id ≠ GetValue ( results ; 4 ) or CCP.Pivot::pivot_title ≠ GetValue ( results ; 3 )
 )

) ];

  If ( update_flag ; "Pivot setup changed, needs updating." ; If ( saved_flag ; "Your work needs saved." ; "" ) )

)

custom formatting: there is a clear button over the section on the pivot screen that controls whether or not the icon should be displayed. It has custom formatting. This is both on the layout "CC Pivot" as well as "CC Pivot Read Only". Change the calc to:

Let ([ update_flag = Let ([

 slicers = List ( CCP.SlicerFields::field_for_sql_c );
 data = List ( CCP.DataFields::field_for_sql_c );
 plu = CCP.Pivot::pivot_last_used

];

 If ( not IsEmpty ( slicers ) and not IsEmpty ( data ) and not IsEmpty ( plu ) ;

   Let ([
     slicer_obj = Substitute ( List ( CCP.SlicerFields::_object_c ) ;  ; "" ) & CC_Dict("Ids" ; List ( CCP.SlicerFields::_record_id_c ) ); 
     data_obj = Substitute ( List ( CCP.DataFields::_object_c ) ;  ; "" ) & CC_Dict("Ids" ; List ( CCP.DataFields::_record_id_c ) ); 
     filter_obj = Substitute ( List ( CCP.FilterFields::_object_c ) ;  ; "" ) & CC_Dict("Ids" ; List ( CCP.FilterFields::_record_id_c ) );
     is = CCP.Pivot::pivot_includeSummaries
   ];
      Case ( 
         CC_DictGet ( plu ; "slicers" ) ≠ slicer_obj ; 1 ;
         CC_DictGet ( plu ; "datas" ) ≠ data_obj ; 1 ;
         CC_DictGet ( plu ; "filters" ) ≠ filter_obj ; 1 ;
         CC_DictGet ( plu ; "summaries" ) ≠ is ; 1 ;
         0
      )
   ) ;
  0
 )

); saved_flag = If ( IsEmpty ( CCP.Pivot::pivot_id ) ; 1 ;

  Let ([
   fn = Substitute ( GetFieldName ( CCP.StoredPivot::html ); "::" ;  );
   id = GetValue ( Substitute ( GetFieldName ( CCP.StoredPivot::id ) ; "::" ;  ) ; 2 );
   table = GetValue ( Substitute ( GetFieldName ( CCP.StoredPivot::table ) ; "::" ;  ) ; 2 );
   title = GetValue ( Substitute ( GetFieldName ( CCP.StoredPivot::title ) ; "::" ;  ) ; 2 );
   style = GetValue ( Substitute ( GetFieldName ( CCP.StoredPivot::style_id ) ; "::" ;  ) ; 2 );
   sql = "SELECT \"" & GetValue ( fn ; 2 ) & "\", \"" & table & "\", \"" & title & "\", \"" & style & "\" FROM \"" & GetValue ( fn ; 1 ) & "\" WHERE \"" & id & "\"='" & CCP.Pivot::pivot_id & "'";
   results = _CC.fnSQL ( sql ; "" ; "" ) 
  ];
  //CCP.Pivot::pivot_html_table ≠ Substitute ( GetValue ( results ; 1 ) ; "\n" ;  ) or 
  CCP.Pivot::pivot_table ≠ GetValue ( results ; 2 ) or CCP.Pivot::pivot_css_table_id ≠ GetValue ( results ; 4 ) or CCP.Pivot::pivot_title ≠ GetValue ( results ; 3 )
 )

) ];

 If ( not update_flag and not saved_flag ; 1 ; 0 )

)

Script Step: CC Pivot->models->current pivot->m.current.pivot.needSaved (Exit Script, Script step):

If ( IsEmpty ( CCP.Pivot::pivot_id ) ; 1 ;

  Let ([
   fn = Substitute ( GetFieldName ( CCP.StoredPivot::html ); "::" ;  );
   id = GetValue ( Substitute ( GetFieldName ( CCP.StoredPivot::id ) ; "::" ;  ) ; 2 );
   table = GetValue ( Substitute ( GetFieldName ( CCP.StoredPivot::table ) ; "::" ;  ) ; 2 );
   style = GetValue ( Substitute ( GetFieldName ( CCP.StoredPivot::style_id ) ; "::" ;  ) ; 2 );
   sql = "SELECT \"" & GetValue ( fn ; 2 ) & "\", \"" & table & "\", \"" & style & "\" FROM \"" & GetValue ( fn ; 1 ) & "\" WHERE \"" & id & "\"='" & CCP.Pivot::pivot_id & "'";
   results = _CC.fnSQL ( sql ; "" ; "" ) 
  ];
  // CCP.Pivot::pivot_html_table ≠ Substitute ( GetValue ( results ; 1 ) ; "\n" ;  ) or 
  CCP.Pivot::pivot_table ≠ GetValue ( results ; 2 ) or CCP.Pivot::pivot_css_table_id ≠ GetValue ( results ; 3 )
 )

)

That should do it.

Edit - Print - Search
Page last modified on August 31, 2011, at 09:18 AM