Xbrowse a speed problem using SCOPE ?

Xbrowse a speed problem using SCOPE ?

Postby ukoenig » Fri Feb 26, 2016 11:27 am

Hello,

I'm using SCOPE to show the CUSTOMERS and the related SERVICES
I noticed, after reaching round about 50 % scrolling through the CUSTOMER-dbf
the speed slows down.
I tested SYSREFRESH(), but no difference
A row of SERVICES shows 38 fields
As well the FOLDER-page is updated

// CUSTOMERS

REDEFINE XBROWSE oBrw1 ID 110 OF oDlg1 AUTOSORT ;
COLUMNS { "NAME1", "NAME", "PFLSTUFE", "MERKER", "VARIANTE" } ;
ALIAS "KUNDE"
SET ORDER TO TAG KUNDE1
...
...
// on CUSTOMER-change the SCOPE for SERVICES is defined

WITH OBJECT oBrw1
:bChange := { || PAT_GET(), ; // read vars CUSTOMERS
DBSELECTAREA( cMonat ), ; // select SERVICES
SET_SCOPE(cMonat), ; // set SCOPE
( cMonat )->( DBGOTOP() ), ; // SERVICE go top
oBrw2:SetPos( 1, 5 ), ; // Col-start-position
V_GET(cMonat), ; // read vars SERVICES
oBrw2:Refresh(), ; // Refresh browser SERVICES
oFld:aDialogs[ nPage ]:Update(), SYSREFRESH() } // Folder-update and Sysrefresh
END


// SERVICES

REDEFINE XBROWSE oBrw2 ID 130 OF oDlg1 AUTOSORT FASTEDIT ;
COLUMNS { "KUNDE", "NAME1","POS0","SIGNAL","AUFBAU", "KENNER", "T1","T2","T3","T4","T5","T6", ;
"T7","T8","T9","T10","T11","T12", ;
"T13","T14","T15","T16","T17","T18", ;
"T19","T20","T21","T22","T23","T24", ;
"T25","T26","T27","T28","T29","T30","T31", "VSUMME1" } ;
ALIAS cMonat


// the defined SCOPE of SERVICES :

STATIC FUNCTION SET_SCOPE(cMonat)
LOCAL cNName := UPPER(( "KUNDE" )->NAME1) + UPPER(( "KUNDE" )->NAME)

DBSELECTAREA( cMonat ) // Services
(cMonat)->( ORDSCOPE(0, cNName ) ) // Customer-name
(cMonat)->(ORDSCOPE(1, cNName ) )
oBrw2:Refresh()

RETURN NIL()


Browser 2 shows the SERVICES a customer receives each month.

Image

Any idea, how to normelize the speed ?

best regards
Uwe :?:
Last edited by ukoenig on Fri Feb 26, 2016 5:45 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Xbrowse a speed problem using SCOPE ?

Postby James Bott » Fri Feb 26, 2016 4:22 pm

Uwe,

Are you using two scopes, one for the name and one for the services. It kind of looks like you are scoping all customers with names starting with "A."

If you are just scoping on services, then have you tried to recreate the problem with a simple example--i.e. just a browse of the scoped services database?

How large is the database?

What RDD are you using?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Xbrowse a speed problem using SCOPE ?

Postby ukoenig » Fri Feb 26, 2016 5:23 pm

James,

Are you using two scopes, one for the name and one for the services.

There is a index on names in CUSTOMER
SERVICES includes the same field
Only ONE scope is defined


How large is the database?

120 records in CUSTOMER
max 8 services for each customer = 960 max in SERVICES


What RDD are you using?

CDX

I included MemStat() and changed the records several times in CUSTOMER
because I don't have as many SERVICES filled like my customer, I switched between some filled records.
I think is the same effect like scrolling downwards in CUSTOMER ?

Image

My customer told me
loosing speed scrolling in xBrowse CUSTOMER after round about 50 records

The structure in short
Code: Select all  Expand view  RUN

// ----------- CUSTOMER

DBSELECTAREA( "KUNDE" )
( "KUNDE" )->(DBSETORDER( "KUNDE1" ))
( "KUNDE" )->( DBGOTOP() )

REDEFINE XBROWSE oBrw1 ID 110 OF oDlg1 AUTOSORT ;
COLUMNS { "NAME1", "NAME", "PFLSTUFE", "MERKER", "VARIANTE" } ;
ALIAS "KUNDE"
SET ORDER TO TAG KUNDE1
....
....
WITH OBJECT oBrw1
    :bChange := { ||    PAT_GET(), ; // CUSTOMER values
                                        DBSELECTAREA( cMonat ), ; // select SERVICES
                        SET_SCOPE(cMonat), ;    // SCOPE
                        ( cMonat )->( DBGOTOP() ), ;
                    V_GET(cMonat), ;    // read vars of SERVICES
                    oBrw2:Refresh(), ;
                    oFld:aDialogs[ nPage ]:Update(), MemStat(), SYSREFRESH() }
END

// -------------- SERVICES

DBSELECTAREA( cMonat )
( cMonat )->(DBSETORDER( cMonat ))
( cMonat )->( DBGOTOP() )

REDEFINE XBROWSE oBrw2 ID 130 OF oDlg1 AUTOSORT  FASTEDIT ;
COLUMNS { "KUNDE", "NAME1","POS0","SIGNAL","AUFBAU", ;
"KENNER", "T1","T2","T3","T4","T5","T6", ;
"T7","T8","T9","T10","T11","T12", ;
"T13","T14","T15","T16","T17","T18", ;
"T19","T20","T21","T22","T23","T24", ;
"T25","T26","T27","T28","T29","T30","T31", "VSUMME1" } ;
ALIAS cMonat
...
...
WITH OBJECT oBrw2
    :bChange := { || V_GET(cMonat), ; // Read vars of SERVICES
                      oFld:aDialogs[ nPage ]:Update() } // Update Folder
END
...
...
// ------------- SCOPE

STATIC FUNCTION SET_SCOPE(cMonat)
LOCAL cNName := UPPER(( "KUNDE" )->NAME1) + UPPER(( "KUNDE" )->NAME) // names from CUSTOMER

DBSELECTAREA( cMonat )
(cMonat)->( ORDSCOPE(0, cNName ) )
(cMonat)->(ORDSCOPE(1, cNName ) )

RETURN NIL
 


Is there maybe still another test possible ?

Any idea ?

Best regards
Uwe :?:
Last edited by ukoenig on Fri Feb 26, 2016 7:40 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Xbrowse a speed problem using SCOPE ?

Postby James Bott » Fri Feb 26, 2016 6:41 pm

Uwe,

OK, with databases that small I don't think the problem has anything to do with scopes. It appears you are losing memory somewhere.

I would try commenting out the set_Scope() and trying it again. This will eliminate scopes as an issue if the same thing happens.

Can I see the PAT_GET() and V_GET() functions?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Xbrowse a speed problem using SCOPE ?

Postby James Bott » Fri Feb 26, 2016 7:03 pm

Uwe,

You can also try commenting out the PAT_GET() and V_GET() calls to see if the problem goes away.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Xbrowse a speed problem using SCOPE ?

Postby ukoenig » Fri Feb 26, 2016 7:40 pm

James,

my first test commenting out SCOPE

using SCOPE
Image

without SCOPE
It reads always the same record from SERVICES ( no skip ) but I think it doesn't matter.

Image

Best regards
Uwe :?:
Last edited by ukoenig on Fri Feb 26, 2016 8:01 pm, edited 3 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Xbrowse a speed problem using SCOPE ?

Postby James Bott » Fri Feb 26, 2016 7:45 pm

Uwe,

OK, so it is not scopes.

I will be away for a couple of hours, but I will check when I get back.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Xbrowse a speed problem using SCOPE ?

Postby ukoenig » Fri Feb 26, 2016 7:48 pm

James,

WITHOUT using Scope ( 2. screenshot ) shows better results.

Instad using SCOPE I can activate
( "KUNDE" )->( ORDSETRELATION( cMonat, { || UPPER(NAME1 + NAME) }, "UPPER(NAME1 + NAME)" ) )
as a test

regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Xbrowse a speed problem using SCOPE ?

Postby ukoenig » Fri Feb 26, 2016 8:00 pm

James,

The functions PAT_GET() and FUNCTION V_GET(cMonat)
are only loading some fields to be shown in folder-pages
nothing special.
and are neede to do some calculations on button < SAVE >

FUNCTION PAT_GET()

aDatP[1] := ("KUNDE")->ANREDE
aDatP[2] := ("KUNDE")->NAME1
aDatP[3] := ("KUNDE")->NAME
aDatP[4] := ("KUNDE")->ANSCHRIFT
aDatP[5] := ("KUNDE")->PLZ
aDatP[6] := ("KUNDE")->ORT
aDatP[7] := ("KUNDE")->GEBDAT
....
...
RETURN NIL

// -----------------

FUNCTION V_GET(cMonat)
LOCAL I

aDat[60] := (cMonat)->VSUMME1
aDat[61] := (cMonat)->WO_PREIS
aDat[62] := (cMonat)->GESPREIS1
aDat[63] := (cMonat)->AUFBAU
aDat[99] := (cMonat)->REST_AN
....
....
RETURN NIL

The 2. Test : changing from SCOPE to ORDSETRELATION

DBSELECTAREA( "KUNDE" )
( "KUNDE" )->(DBSETORDER( "KUNDE1" ))
( "KUNDE" )->( ORDSETRELATION( cMonat, { || UPPER(NAME1 + NAME) }, "UPPER(NAME1 + NAME)" ) )
( "KUNDE" )->( DBGOTOP() )


see the difference from SCOPE-screenshots :
Maybe better using ORDSETRELATION ?
No problem sendig the test to my customer if there is a better speed

Image

best regards
Uwe :?:
Last edited by ukoenig on Sat Feb 27, 2016 9:25 am, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Xbrowse a speed problem using SCOPE ?

Postby James Bott » Fri Feb 26, 2016 8:17 pm

I just about to walk out the door, so just some quick comments.

I don't think there is a significant difference in the memory usage. Between 2 and 3 there is a huge jump.

I think you are leaking resources somewhere.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Xbrowse a speed problem using SCOPE ?

Postby ukoenig » Tue Mar 01, 2016 10:25 am

James,

today my customer got 2 versions of the program for testing
One with using SCOPE and another one using SETRELATION

He noticed that the version using SETRELATION works much faster
and the problem was solved.
I think a seek ( SETRELATION ) will work faster than filtering ( SCOPE )
In case there are only one or two records to filter there is no problem
but there was a SCOPE up to 10 records in file SERVICES

can that be a reason ?

best regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Xbrowse a speed problem using SCOPE ?

Postby James Bott » Tue Mar 01, 2016 4:04 pm

Uwe,

Please explain how you solved it using SET RELATION. That just keeps the records synced but it doesn't limit the display to a set of data (e.g. one customer).

Also, speed could be affected by the database scope and/or the browse. Have you checked the speed of just the scope without the browse?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Xbrowse a speed problem using SCOPE ?

Postby nageswaragunupudi » Tue Mar 01, 2016 4:42 pm

Please explain how you solved it using SET RELATION. That just keeps the records synced but it doesn't limit the display to a set of data (e.g. one customer).

I think SCOPED RELATION.

Command syntax:
SET RELATION TO ......... SCOPED

Function:
OrdSetRelation( .... )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Xbrowse a speed problem using SCOPE ?

Postby Horizon » Tue Mar 01, 2016 6:44 pm

nageswaragunupudi wrote:
Please explain how you solved it using SET RELATION. That just keeps the records synced but it doesn't limit the display to a set of data (e.g. one customer).

I think SCOPED RELATION.

Command syntax:
SET RELATION TO ......... SCOPED

Function:
OrdSetRelation( .... )


Hi Mr. Rao,

Any example for SET RELATION TO ......... SCOPED?

Thanks
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: Xbrowse a speed problem using SCOPE ?

Postby ukoenig » Tue Mar 01, 2016 6:49 pm

A extract and complete test of the service-section using the original files reduced
to 2 related browser with indexed fields < Name 1 and Name 2 > ( NO SCOPE )
Scrolling in CUSTOMER works very fast !!!

http://www.pflegeplus.com/DOWNLOADS/Testrel1.zip

Image

// ------- DATABASE CUSTOMER and SERVICES

REQUEST DBFCDX
RDDSETDEFAULT ( "DBFCDX" )

NET_USE ( c_Pfad + "KUNDE.dbf", "KUNDE", 3, .T. )
DBSELECTAREA("KUNDE")
ORDCREATE( ,"KUNDE1","UPPER(NAME1 + NAME)", ;
{|| UPPER(NAME1 + NAME) } , .F. )


NET_USE ( c_Pfad + cMonat + ".dbf", "VPOS12", 3, .T. )
ORDCREATE( ,"VPOS12", "UPPER(KUNDE + NAME1 + KENNER)", ;
{|| UPPER(KUNDE + NAME1 + KENNER) } , .F. ) // .T. = UNIQUE


// ------ CUSTOMER -> RELATION to SERVICES with Index on Name1 and Name 2

DBSELECTAREA( "KUNDE" )
( "KUNDE" )->(DBSETORDER( "KUNDE1" ))
( "KUNDE" )->( ORDSETRELATION( cMonat, { || UPPER(NAME1 + NAME) }, "UPPER(NAME1 + NAME)" ) )
( "KUNDE" )->( DBGOTOP() )

REDEFINE XBROWSE oBrw1 ID 110 OF oDlg1 AUTOSORT ;
COLUMNS { "NAME1", "NAME" } ;
ALIAS "KUNDE"
SET ORDER TO TAG KUNDE1


// -------- SERVICES

DBSELECTAREA( cMonat )
( cMonat )->(DBSETORDER( cMonat ))
( cMonat )->( DBGOTOP() )

REDEFINE XBROWSE oBrw2 ID 130 OF oDlg1 AUTOSORT FASTEDIT ;
COLUMNS { "KUNDE", "NAME1", "POS0" } ;
ALIAS cMonat


best regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 93 guests

cron