Hi all,
I have one page in a 20 plus page ABM web app that is too slow.
About 4 pages ago I noticed that Alain was using code like :-
This is from ABMShared.
I extended this with code to create components for example a ABMlabel :-
Now I am not saying that this is causing the problem. I just want you guys opinion.
I really like the concept it compresses my code in ConnectPage like this :-
I find this allows me to better view components and layout.
Enough back ground! Here is ConnectPage complete with some log() timings :-
and here is part of my log output :-
So why is refresh.page taking 10 seconds?
Is it my code?
Anyone have an idea?
Rob
I have one page in a 20 plus page ABM web app that is too slow.
About 4 pages ago I noticed that Alain was using code like :-
Alain's code:
public Sub BuildHeader(page As ABMPage, id As String, Text As String) As ABMLabel
Dim hdr As ABMLabel
hdr.Initialize(page, id, Text, ABM.SIZE_H5, False, "header")
Return hdr
End Sub
This is from ABMShared.
I extended this with code to create components for example a ABMlabel :-
Code to build a label:
Sub Process_Globals
End Sub
public Sub Add2Page(Pg As ABMPage,ID As String,Title As String,Size As String,CellRow As Int, CellCol As Int) As ABMLabel
Dim L As ABMLabel
L.Initialize(Pg,ID,Title,Size,False,"mytheme")
Pg.Cell(CellRow,CellCol).AddComponent(L)
Return l
End Sub
Public Sub GetText(Pg As ABMPage,ID As String) As String
Dim L As ABMLabel = Pg.Component(ID)
Return L.Text
End Sub
Public Sub SetText(Pg As ABMPage,ID As String,T As String)
Dim L As ABMLabel = Pg.Component(ID)
L.Text = T
L.Refresh
End Sub
Now I am not saying that this is causing the problem. I just want you guys opinion.
I really like the concept it compresses my code in ConnectPage like this :-
Part ConnectPage and:
page.AddRows(1,True,"").AddCellsOS(1,0,0,0,12,12,4,"")
page.AddRows(1,True,"").AddCellsOS(1,0,0,0,8,5,2,"").AddCellsOS(2,0,0,0,2,2,2,"")
page.AddRows(1,True,"").AddCellsOS(3,0,0,0,4,4,4,"")
page.AddRows(1,True,"").AddCellsOS(1,0,0,0,4,4,4,"").AddCellsOS(1,1,1,1,6,6,6,"")
page.AddRows(1,True,"").AddCellsOS(1,0,0,0,12,12,12,"")
page.AddRows(1,True,"").AddCellsOS(2,1,1,1,7,7,7,"")
page.AddRows(1,True,"").AddCellsOS(1,0,0,0,4,4,4,"").AddCellsOS(1,1,1,1,4,4,4,"")
page.BuildGrid 'IMPORTANT once you loaded the complete grid AND before you start adding components
End Sub
public Sub ConnectPage()
Dim startT As Long = DateTime.Now
Log($"Start ConnectPage -----------------> 0"$)
Dim labTitle As ABMLabel = ABMlab.Add2Page(page,"labtitle",Act.PageTitle1(ws),ABM.SIZE_H5,1,1)
Dim rgAggrigation As ABMRadioGroup = ABMrg.Add2Page(page,"rgaggrigation",2,1)
ABMrg.addItem(page,"rgaggrigation","All",False)
ABMrg.addItem(page,"rgaggrigation","Client",False)
ABMrg.addItem(page,"rgaggrigation","Farm",False)
ABMrg.addItem(page,"rgaggrigation","Paddock",False)
ABMrg.SetItem(page,"rgaggrigation",0)
Dim cboClient As ABMCombo = ABMcbo.Add2Page(page,"cboclient","Client",3,1)
Dim cboFarm As ABMCombo = ABMcbo.Add2Page(page,"cbofarm","Farm",3,2)
Dim cboPaddock As ABMCombo = ABMcbo.Add2Page(page,"cbopaddock","Paddock",3,3)
Dim cboActivity As ABMCombo = ABMcbo.Add2Page(page,"cboactivity","Activity",4,1)
Dim butShowRpt As ABMButton = ABMbut.Add2Page(page,"butshowrpt","raised","","Show report",4,2)
Dim edt As ABMEditor = ABMEdt.Add2Page(page,"edt",5,1)
Dim inpEmail As ABMInput = ABMInp.Add2Page(page,"inpEmail","Email address (blank for none)",ABM.INPUT_TEXT,False,6,1)
Dim butEmail As ABMButton = ABMbut.Add2Page(page,"butemail","raised","","Send",7,1)
Dim butHome As ABMButton = ABMbut.Add2Page(page,"buthome","raised","","Home",7,2)
Enough back ground! Here is ConnectPage complete with some log() timings :-
ConnectPage:
public Sub ConnectPage()
Dim startT As Long = DateTime.Now
Log($"Start ConnectPage -----------------> 0"$)
Dim labTitle As ABMLabel = ABMlab.Add2Page(page,"labtitle",Act.PageTitle1(ws),ABM.SIZE_H5,1,1)
Dim rgAggrigation As ABMRadioGroup = ABMrg.Add2Page(page,"rgaggrigation",2,1)
ABMrg.addItem(page,"rgaggrigation","All",False)
ABMrg.addItem(page,"rgaggrigation","Client",False)
ABMrg.addItem(page,"rgaggrigation","Farm",False)
ABMrg.addItem(page,"rgaggrigation","Paddock",False)
ABMrg.SetItem(page,"rgaggrigation",0)
Dim cboClient As ABMCombo = ABMcbo.Add2Page(page,"cboclient","Client",3,1)
Dim cboFarm As ABMCombo = ABMcbo.Add2Page(page,"cbofarm","Farm",3,2)
Dim cboPaddock As ABMCombo = ABMcbo.Add2Page(page,"cbopaddock","Paddock",3,3)
Dim cboActivity As ABMCombo = ABMcbo.Add2Page(page,"cboactivity","Activity",4,1)
Dim butShowRpt As ABMButton = ABMbut.Add2Page(page,"butshowrpt","raised","","Show report",4,2)
Dim edt As ABMEditor = ABMEdt.Add2Page(page,"edt",5,1)
Dim inpEmail As ABMInput = ABMInp.Add2Page(page,"inpEmail","Email address (blank for none)",ABM.INPUT_TEXT,False,6,1)
Dim butEmail As ABMButton = ABMbut.Add2Page(page,"butemail","raised","","Send",7,1)
Dim butHome As ABMButton = ABMbut.Add2Page(page,"buthome","raised","","Home",7,2)
ABMcbo.Hide(page,"cboclient")
ABMcbo.Hide(page,"cbofarm")
ABMcbo.Hide(page,"cbopaddock")
'ABMcbo.Hide(page,"cboactivity")
ABMEdt.hide(page,"edt")
ABMInp.hide(page,"inpemail")
ABMbut.Hide(page,"butemail")
Log($"ConnectPage B4 fill cbos -----------------> ${DateTime.Now - startT}"$)
Dim Q As String = "SELECT * FROM Clients"
ABMcbo.Fill(page,"cboclient",Main.PDsql,Q)
Log($"ConnectPage after fill cbosclient -----------------> ${DateTime.Now - startT}"$)
Q = "SELECT * FROM Activities WHERE ActivityReports < 99"
ABMcbo.Fill(page,"cboactivity",Main.PDsql,Q)
Log($"ConnectPage after fill cboactivity -----------------> ${DateTime.Now - startT}"$)
' refresh the page
page.Refresh
Log($"ConnectPage after refresh -----------------> ${DateTime.Now - startT}"$)
' Tell the browser we finished loading
page.FinishedLoading
Log($"End ConnectPage -----------------> ${DateTime.Now - startT}"$)
End Sub
Partial log output:
Key = itemid, value = FarmActRptsPage
Key = eventparams, value = itemid
Key = eventname, value = cboactivity_clicked
-----------------------------------------------------
ExecuteMap: SELECT DB2Count,Name FROM Activities WHERE EntryPage = 'FarmActRptsPage' ORDER BY SortOrder ASC
Going to page FarmActRptsPage
Disconnected
ExecuteListOfMaps: SELECT * FROM Clients
ExecuteListOfMaps: SELECT * FROM SeedTypes
ExecuteListOfMaps: SELECT * FROM Ferts
ExecuteListOfMaps: SELECT * FROM Cultivars
ExecuteListOfMaps: SELECT * FROM SeedSource
ExecuteListOfMaps: SELECT * FROM SowDepth
ExecuteListOfMaps: SELECT * FROM MoistConditions
ExecuteListOfMaps: SELECT * FROM CoverCond
Connected
Websocket first connection
Start ConnectPage -----------------> 0
GetAttrib pagename
ConnectPage B4 fill cbos -----------------> 6
ExecuteListOfMaps: SELECT * FROM Clients
ABMccbo.fill found 20 items
ConnectPage after fill cbosclient -----------------> 10
ExecuteListOfMaps: SELECT * FROM Activities WHERE ActivityReports < 99
ABMccbo.fill found 6 items
ConnectPage after fill cboactivity -----------------> 14
ConnectPage after refresh -----------------> 10034
End ConnectPage -----------------> 10034
FarmActRptsPage499def0f-e482-4239-8f59-aa20ddc071cf
Evt fired --->edt_loaded Number params = 3
Key = eventparams, value = target
Key = eventname, value = edt_loaded
Key = target, value = edt
-----------------------------------------------------
So why is refresh.page taking 10 seconds?
Is it my code?
Anyone have an idea?
Rob