Dataset switching raises an error

edited June 2021 in FastCube 2

Hi, I e s switch by code between two dataset's which query's are made previously by code and taking the date range from the user, but I received an error message.

I did open one of the datasets and work with data, thitching raises an erroren saved it onto a cube file. After, I did the same with the other dataset. Now, I open the cube file of the first dataset and work with it and could see their field list, then I open the other dataset, but in this case I reach the following error message on the last line of the code: "FastCube error: Field CODIGOPRODUCTO not exists in DataSet fcxDBDataSet1;" as if the fcxCube remains with the previous dataset.

How could I solve this problem and switch between these two dataset's or more?

This is the code that I'm using:

fcxCube1->Close();
fcxDBDataSet1->DataSet = NULL;
PanelCubos->Width = PanelGraficosCubos->Width - 20;
if(RG_TipoPivot->ItemIndex == 0) { // Caso Compras
   DM_FRep->IBQ_VistaDetComprasIngred->Close();
   DM_FRep->IBQ_VistaDetComprasIngred->Params->ParamByName("INICIO")->AsDate 
      = StrToDate(F_Inicio);
   DM_FRep->IBQ_VistaDetComprasIngred->Params->ParamByName("TERMINO")->AsDate
      = StrToDate(F_Termino);
   DM_FRep->IBQ_VistaDetComprasIngred->Open();
   fcxDBDataSet1->DataSet = DM_FRep->IBQ_VistaDetComprasIngred;
} else if(RG_TipoPivot->ItemIndex == 1) { // Caso Ventas
   DM_FRep->IBQ_VistaDetHistVtasProd->Close();
   DM_FRep->IBQ_VistaDetHistVtasProd->Params->ParamByName("INICIO")->AsDate = StrToDate(F_Inicio);
   DM_FRep->IBQ_VistaDetHistVtasProd->Params->ParamByName("TERMINO")->AsDate 
      = StrToDate(F_Termino);
   DM_FRep->IBQ_VistaDetHistVtasProd->Open();
   fcxDBDataSet1->DataSet = DM_FRep->IBQ_VistaDetHistVtasProd;
}
fcxCube1->Open();

Best regards,

Patricio Cerda

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.