Dataset switching raises an error
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