Rave 4 and later-Dynamically Created DataViews

Category

Rave - Data Connections

Question

I want to dynamically create a dataview for use in Rave. The code I was using in Rave 3 no longer works. What is the correct way to do this with Rave 4 and later?

Solution

Starting with Rave 4, the procedure for creating a dynamic DataView object has changed slightly but is quite easily done. You will need to include RVData and RVDirectDataView into your unit that is going to create the DataView and then make the following call:

Delphi Example:

var
  trdv: TRaveDataView;

begin
  trdv := RaveProject1.ProjMan.NewDataObject(TRaveDataView) as TRaveDataView;
  trdv.ConnectionName := 'RPTableConnection1';
  CreateFields(trdv,nil,nil,true);
end;

C++Builder Example:

{
  TRaveDataView *trdv;
  trdv = dynamic_cast(RaveProject1->ProjMan->NewDataObject(GetClass("TRaveDataView")));
  trdv->ConnectionName = "RPTableConnection1";
  CreateFields(trdv, NULL, NULL,true);
}