Fast Reload of Cube

Discussion forum for PivotCube VCL users. Common questions. Bug and problem reports

Moderator: Alex Zencovich

Fast Reload of Cube

Postby sn00py » Tue Sep 12, 2006 7:58 am

If the user clicks fast in my Listview, (and i would like to reload every time the cube, i get an error)

cubeData.Active := FALSE;
cubeData.Active := TRUE;


It seems that if i set cubeData.Active := TRUE; the cube is loading some data in the backgriund and if i set cubeData.Active := FALSE; i get an error becuase the cube is loading still data.

Is there somewhere a flag are something else i can check, that the cube is still loading ?
sn00py
Developer
 
Posts: 21
Joined: Tue Sep 12, 2006 7:50 am

Postby AlexZencovich » Tue Sep 12, 2006 9:47 am

PivotCube does nothing in background. But Windows may take some time to create/free OLE servers. Also, setting Active :=

1 Try to use next code

if Cube.Active then Cube.Active := False;
if not Cube.Active then Cube.Active := True;

2. Try to call Application Processmessages after each cube state change. Please note, when you set Cube.Active to true it tried to connect to database, fetch all facttable records and build cube. Connect and fetching is most time-consuming operation in that process so you should handle them from re-entry because if you work with standalone server (like SQL server or Interbase) it will really background operations
Best regards,

Alex Zencovich
-------------------------------------------------------------------------------------------------------------------------------------------
www.pivotcube.com - OLAP solution for Delphi, C++ Builder and ActiveX environment
AlexZencovich
Site Admin
 
Posts: 580
Joined: Sun Jun 18, 2006 10:09 am

Postby sn00py » Tue Sep 12, 2006 10:18 am

I tried both things but didn't helped

The error i get is if i set Active to false.
in this line (arround line 3315 in unit PivotMap_SRC) : Cube.Intf.DestroyMap(Self);

Is there somewhere a state of the cube, if all data are loaded, or can i abort the load process ?
sn00py
Developer
 
Posts: 21
Joined: Tue Sep 12, 2006 7:50 am

Postby AlexZencovich » Tue Sep 12, 2006 11:17 am

Hmm, I will try to reproduce problem on my side, because I never get something similar.
Try to set PivotMap.Cube to nil before set TPivotCube.Active to False and restore PivotMap.Cube after TPivotCube.Active became True
Best regards,

Alex Zencovich
-------------------------------------------------------------------------------------------------------------------------------------------
www.pivotcube.com - OLAP solution for Delphi, C++ Builder and ActiveX environment
AlexZencovich
Site Admin
 
Posts: 580
Joined: Sun Jun 18, 2006 10:09 am

Postby sn00py » Tue Sep 12, 2006 11:57 am

No, it doesn't help, if i clear cubeMap.Cube and reset it after setting active to true, i didn't get new data, and if i click on the cube i get errors

This is the code i use for reloading the Cube (because of some params in the SQL has changed)

Code: Select all
procedure TframeCubeInline.Reload;
begin
  //  cubeMap.Cube    := nil;
    cubeData.Active := False;
    PostMessage(Handle, WM_USER+200, 0, 0);
end;

procedure TframeCubeInline.MsgReload(var Msg : TMessage);
var
    i               : integer;
    dummy           : Boolean;
begin
    fFactTable.SQL.Text     := fCubeDef.SQLCommand;
    for i:=0 to fFactTable.Params.Count-1 do
        fFactTable.Params[i].Value  := fParams.GetVariable_Variant(fFactTable.Params[i].Name, dummy);
    fFactTable.Open;
    cubeData.Active         := TRUE;
//    cubeMap.Cube            := cubeData;
end;
sn00py
Developer
 
Posts: 21
Joined: Tue Sep 12, 2006 7:50 am

Postby AlexZencovich » Tue Sep 12, 2006 12:21 pm

if i clear cubeMap.Cube and reset it after setting active to true, i didn't get new data


1 set TPivotMap.Active to True too, after you assign TPivotMap.Cube, it will force refresh.

2 Pity, but I cannot reproduce error on my side. Probably I'm not so fast like you users. There really exists a little chink where error may happen - at line 2000 in PivotCube_SRC.pas

FActive := True;
UpdateMaps(True);

it mean, if you try to set FActive to False before UpdateMaps not finished, you may get an error, because cube will try to destroy uninitialized maps. I cannot switch these lines because TPivotMap.SetActive will check if cube is Active to set map active too.

Try to use PivotMap.OnAfterOpen event to allow next cube activation, otherwise user click should be ignored
Best regards,

Alex Zencovich
-------------------------------------------------------------------------------------------------------------------------------------------
www.pivotcube.com - OLAP solution for Delphi, C++ Builder and ActiveX environment
AlexZencovich
Site Admin
 
Posts: 580
Joined: Sun Jun 18, 2006 10:09 am

Postby sn00py » Tue Sep 12, 2006 12:44 pm

no, it must be something else ....

i still get the error

and if i build the cube, i see, that the event occurs, and after that event i see about 2 seconds refreshing the cube and in these 2 sconds i get a error, if i deactivate the cube.
sn00py
Developer
 
Posts: 21
Joined: Tue Sep 12, 2006 7:50 am

Postby AlexZencovich » Tue Sep 12, 2006 2:28 pm

How many maps you have? After even occured, there are no code to be executed, except probably windows internal code
Best regards,

Alex Zencovich
-------------------------------------------------------------------------------------------------------------------------------------------
www.pivotcube.com - OLAP solution for Delphi, C++ Builder and ActiveX environment
AlexZencovich
Site Admin
 
Posts: 580
Joined: Sun Jun 18, 2006 10:09 am

Postby sn00py » Tue Sep 12, 2006 2:33 pm

only one MAP
sn00py
Developer
 
Posts: 21
Joined: Tue Sep 12, 2006 7:50 am

Postby sn00py » Tue Sep 12, 2006 4:14 pm

Because of, i didn't have the actuall version installed, i just would like to do so now.

But i downloaded the newest file, and if i install it, it ask for a second file (*.002) but i don't have such a file ...

(Where can i see the actual version which version i have installed ?)
sn00py
Developer
 
Posts: 21
Joined: Tue Sep 12, 2006 7:50 am

Postby AlexZencovich » Tue Sep 12, 2006 4:27 pm

It ask probaby because trasnsfer was interrupted but no finished. Try download it again, it will newest version, uploaded today.
Best regards,

Alex Zencovich
-------------------------------------------------------------------------------------------------------------------------------------------
www.pivotcube.com - OLAP solution for Delphi, C++ Builder and ActiveX environment
AlexZencovich
Site Admin
 
Posts: 580
Joined: Sun Jun 18, 2006 10:09 am

Postby sn00py » Wed Sep 13, 2006 11:22 am

Just installed the new version, but still get this error
sn00py
Developer
 
Posts: 21
Joined: Tue Sep 12, 2006 7:50 am

Postby AlexZencovich » Wed Sep 13, 2006 12:07 pm

Could you perform example which will show error? Pity but I cannot reproduce it on my side
Best regards,

Alex Zencovich
-------------------------------------------------------------------------------------------------------------------------------------------
www.pivotcube.com - OLAP solution for Delphi, C++ Builder and ActiveX environment
AlexZencovich
Site Admin
 
Posts: 580
Joined: Sun Jun 18, 2006 10:09 am

Postby sn00py » Wed Sep 13, 2006 1:06 pm

hmmm, i build a demo project, but if i start i, i get an error "Can't load Typebibliothek/DLL"

The main project works fine, is there somewhere a setting so, that the vcl-source is used instead of the dll ?
sn00py
Developer
 
Posts: 21
Joined: Tue Sep 12, 2006 7:50 am

Postby AlexZencovich » Wed Sep 13, 2006 3:04 pm

Check the _NONDLL option in package and project. If you built with dll it must have _NONDLL define and path set to nonDLL directory
Best regards,

Alex Zencovich
-------------------------------------------------------------------------------------------------------------------------------------------
www.pivotcube.com - OLAP solution for Delphi, C++ Builder and ActiveX environment
AlexZencovich
Site Admin
 
Posts: 580
Joined: Sun Jun 18, 2006 10:09 am

Next

Return to PivotCube VCL

Who is online

Users browsing this forum: No registered users and 3 guests

cron