Hi there
For this exercise I wanted to have a dashboard that will provide me with total Expenditure vs Budget as demonstrated in Figure 1 below. In this table, records are added that will have a budget and expenditure. The expenditure amounts are a sum up of records captured in another screen. This record copying and drill down (i.e master-detail) functionality was discussed in this article.
Figure 1
I had improved the JustGage custom component as discussed in more detail in this article and added this on top of my ABMTable at R2C2.
What this needed to do was refresh the dashboard each time a record is added, updated, cloned and deleted. To achieve this I had to ensure that the refresh method of the custom JustGage was linked to the ABMTable refresh method.
The expenditure and budget values in the dashboard justgage are based on the records captured thus I needed a way to read these details from the underlying database and then refresh the justgage.
My ConnectPage page created the grid, the dashboard, the search functionality and the table as defined here.
As you might have noticed here I added a {NBSP} on R2C1 instead of cell offsets to ensure that the dashboard sits on the correct position. This is just my own safety net.
My ABMTable Refresh method call as defined below includes also the JustGage refresh method. This ensured that whatever table functionality like adding, updating, cloning and deleting the records was also linked to the dashboard refresh.
For this exercise I wanted to have a dashboard that will provide me with total Expenditure vs Budget as demonstrated in Figure 1 below. In this table, records are added that will have a budget and expenditure. The expenditure amounts are a sum up of records captured in another screen. This record copying and drill down (i.e master-detail) functionality was discussed in this article.
Figure 1
I had improved the JustGage custom component as discussed in more detail in this article and added this on top of my ABMTable at R2C2.
What this needed to do was refresh the dashboard each time a record is added, updated, cloned and deleted. To achieve this I had to ensure that the refresh method of the custom JustGage was linked to the ABMTable refresh method.
The expenditure and budget values in the dashboard justgage are based on the records captured thus I needed a way to read these details from the underlying database and then refresh the justgage.
My ConnectPage page created the grid, the dashboard, the search functionality and the table as defined here.
B4X:
Public Sub ConnectPage()
'connect navigation bar
ConnectNavigationBar
Dim NowWH As String = ABM.GetBrowserWidthHeight(page)
If NowWH <> "" And NowWH <> ";" Then
Dim split() As String = Regex.Split(";", NowWH)
Dim NewH As Int = split(1) - 350
NewH = NewH / 50
NewH = NewH / 5
NewH = NewH * 5
If NewH >= 10 Then
MaxRows = NewH
End If
End If
'add components for the page
Dim txtSearchProcurementPlan As ABMInput
txtSearchProcurementPlan.Initialize(page, "txtSearchProcurementPlan", ABM.INPUT_TEXT, "Search", False, "lightblue")
page.Cell(3,1).AddComponent(txtSearchProcurementPlan)
Dim btnSearchProcurementPlan As ABMButton
btnSearchProcurementPlan.InitializeFloating(page, "btnSearchProcurementPlan", "mdi-action-search", "")
page.Cell(3,2).AddComponent(btnSearchProcurementPlan)
Dim ProcurementPlanPager As ABMPagination
ProcurementPlanPager.Initialize(page, "ProcurementPlanPager", 10, True, True, "")
ProcurementPlanPager.SetTotalNumberOfPages(10)
page.Cell(4,1).AddComponent(ProcurementPlanPager)
Dim lblProcurementPlandashboard As ABMLabel
lblProcurementPlandashboard.Initialize(page, "lblProcurementPlandashboard", "{NBSP}", ABM.SIZE_PARAGRAPH, False, "")
page.Cell(2,1).AddComponent(lblProcurementPlandashboard)
jg2048.Initialize(page, "jg2048", 0,"Expenditure vs Budget","")
jg2048.pointertoplength = -15
jg2048.pointerbottomlength = 10
jg2048.pointerbottomwidth = 12
jg2048.pointercolor = fx.Colors.rgb(142,142,147)
jg2048.pointerstroke = fx.colors.rgb(255,255,255)
jg2048.pointerstrokewidth = 3
jg2048.pointerstrokelinecap = jg2048.EnumPointerStrokeLineCap.isround
jg2048.pointerstrokewidth = 3
jg2048.levelcolor1 = fx.colors.rgb(161,136,127)
jg2048.levelcolor2 = fx.colors.rgb(161,136,127)
jg2048.levelcolor3 = fx.colors.rgb(161,136,127)
jg2048.humanfriendlydecimal = 0
jg2048.gaugewidthscale = 0.6
jg2048.gaugecolor = fx.Colors.RGB(237,235,235)
jg2048.labelfontcolor = fx.Colors.RGB(179,179,179)
jg2048.shadowopacity = 0.2
jg2048.shadowsize = 5
jg2048.shadowverticaloffset = 3
jg2048.startanimationtime = 700
jg2048.startanimationtype = jg2048.EnumAnimationType.right
jg2048.refreshanimationtime = 700
jg2048.refreshanimationtype = jg2048.EnumAnimationType.right
jg2048.donutstartangle = 90
jg2048.valueminfontsize = 14
jg2048.titleminfontsize = 10
jg2048.labelminfontsize = 10
jg2048.minlabelminfontsize = 10
jg2048.maxlabelminfontsize = 10
jg2048.hidevalue = False
jg2048.hideminmax = False
jg2048.titlefontcolor = fx.Colors.rgb(153,153,153)
jg2048.hideinnershadow = False
jg2048.humanfriendly = True
jg2048.nogradient = False
jg2048.donut = False
jg2048.relativegaugesize = True
jg2048.counter = True
jg2048.decimals = 0
jg2048.formatnumber = True
jg2048.pointer = False
jg2048.titleposition = jg2048.EnumTitlePosition.above
jg2048.valuefontcolor = fx.Colors.black
jg2048.minvalue = 0
jg2048.maxvalue = 100
jg2048.reverse = False
RefreshOnLoad_jg2048
page.Cell(2,2).AddComponent(jg2048.ABMComp)
Dim tblProcPlan As ABMTable
tblProcPlan.Initialize(page, "tblProcPlan", False, False, True, "tblTheme")
tblProcPlan.IsBordered = True
tblProcPlan.IsResponsive = True
tblProcPlan.IgnoreFormattingCodes = False
tblProcPlan.IsTextSelectable = True
tblProcPlan.SetHeaders(Array As String("ID", "Seq Number", "Fin Year", "Programme", "Class", "Project", "Resource", "Status", "Budget", "Expenditure", "Advert Date", "Completion Date", "Comment", "Edit", "Payments", "Copy", "Delete"))
tblProcPlan.SetHeaderThemes(Array As String("bg", "bg", "bg", "bg", "bg", "bg", "bg", "bg", "bgr", "bgr", "bg", "bg", "bg", "bgc", "bgc", "bgc", "bgc"))
tblProcPlan.SetHeaderHeights(Array As Int(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 48, 48, 48))
tblProcPlan.SetColumnVisible(Array As Boolean(False, True, True, True, True, True, True, True, True, True, True, True, False, True, True, True, True))
tblProcPlan.SetColumnSortable(Array As Boolean(False, True, True, True, True, True, True, True, True, True, True, False, False, False, False, False, False))
tblProcPlan.SetColumnDataFields(Array As String("id", "SeqNumber", "FinYear", "Programme", "ClassOfGoods", "Description", "Resource", "Status", "Budget", "Expenditure", "AdvertDate", "CompletionDate", "Comment", "", "", "", ""))
page.Cell(5,1).AddComponent(tblProcPlan)
Dim frmProcPlanNewRecord As ABMActionButton
frmProcPlanNewRecord.Initialize(page, "frmProcPlanNewRecord", "mdi-content-add", "", "bigblue")
frmProcPlanNewRecord.MainButton.Size = ABM.BUTTONSIZE_LARGE
page.AddActionButton(frmProcPlanNewRecord)
AdminAccess
page.Refresh ' IMPORTANT
' NEW, because we use ShowLoaderType=ABM.LOADER_TYPE_MANUAL
page.FinishedLoading 'IMPORTANT
page.RestoreNavigationBarPosition
LoadProcurementPlan(1)
End Sub
As you might have noticed here I added a {NBSP} on R2C1 instead of cell offsets to ensure that the dashboard sits on the correct position. This is just my own safety net.
My ABMTable Refresh method call as defined below includes also the JustGage refresh method. This ensured that whatever table functionality like adding, updating, cloning and deleting the records was also linked to the dashboard refresh.