/
ピボットのデータを保存しない

ピボットのデータを保存しない

CCピボットは通常、ピボットが保存されるたびにピボットのデータを保存しますが、このデータを保存したくないことがあるかもしれません。

保存しない方法をご紹介しますが、その前に注意していただきたいことがあります。データを保存するようにしている主な理由のひとつは、iOSでピボット表を表示できるようにするためです。iOSは、必要なピボットのデータを生成するには処理のパワーが不足しておりプラグインもサポートしていないため、データをデスクトッププラットフォームに保管して、iPadクライアントが以前に生成されたピボット表のブラウズは少なくともできるようにしています。とは言え、保存しないようにしたい場合には、2つのスクリプトを少しだけ変更する方法が最適であると考えられます。

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

この2つのスクリプトのはじめの方で、変数の「$html」に値を設定しています。計算式全体をコメントアウトして、「""」に設定してください。これでデータが保管されなくなります。

このようにすると、ピボットが保存されていないときでも保存が必要であるとシステムは判断します。ユーザはHTMLを保存したいものとみなすためです(現在のHTMLと保管されたHTMLをチェックの一部として比較し、ピボットを保存する必要があるかどうか調べます)。これを解決するには、計算式を3か所変更する必要があります(フィールド、条件付き書式、スクリプトステップを各1か所)。

 変更は、次の通りです。

フィールド:CCP.StoredPivot::unsaved_c calculation

次のように変更します

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." ; "" ) )
)
条件付き書式

 ピボットのセクションを覆う透明のボタンが1つあり、これがアイコンの表示/非表示を制御しています。これには条件付き書式が設定されています。このボタンは、「CC Pivot」レイアウトと「CC Pivot Read Only」のレイアウトの両方にあります。計算式を次のように変更します。

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 )

)
スクリプトステップ:CC Pivot->models->current pivot->m.current.pivot.needSaved

 (Exit スクリプトのスクリプトステップ)

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 )
 )

)

これで動作するはずです。

Related content

スーパーコンテナー比較表
スーパーコンテナー比較表
More like this
ピボットを作る
ピボットを作る
More like this
ピボットを作る
ピボットを作る
More like this
ピボットを作る
ピボットを作る
More like this
ピボットを作る
ピボットを作る
More like this
ブログ
More like this