Grid with filter?

Hi, I am trying to make a grid with filter above. I wrote this SAIL:
= load(
local!BUfilter,
local!pagingInfo: a!pagingInfo(
startIndex: 1,
batchSize: - 1,
sort: {
field: "InvestmentMain.InvID",
ascending: false
}
),
with(
local!datasubset: if(
isnull(
local!BUfilter
),
rule!getAllInvestments(
local!pagingInfo
),
rule!getInvestmentByBU(
local!BUfilter,
local!pagingInfo
)
),
a!dashboardLayout(
firstColumnContents: {
a!textField(
label: "Filter by Bu",
value: local!BUfilter,
saveInto: local!BUfilter,
refreshAfter: "KEYPRESS"
),
a!gridField(
totalCount: local!datasubset.totalCount,
columns: {
a!gridTextColumn(
label: "ID",
data: local!datasubset.data.InvestmentMain.InvID,
field: "InvestmentMain.InvID...

OriginalPostID-97336

OriginalPostID-97336

  Discussion posts and replies are publicly visible

Parents
  • Hello,
    I'm not sure about the specifics of this issue, but perhaps a change in construction could solve it and improve performance simultaneously

    Above it appears that you requery the database as the user types in the field. This could be very slow. If possible, I would recommend you move the query "getAllInvestments" up into the load() in a local variable called investments.
    Then, as users type in the filter try something like this inside the with()
    local!datasubset: if(isnull(BUfilter),investments,index(investments,where(apply(search(BUfilter,_),investments.InvestmentMain.BusinessUnit))))
Reply
  • Hello,
    I'm not sure about the specifics of this issue, but perhaps a change in construction could solve it and improve performance simultaneously

    Above it appears that you requery the database as the user types in the field. This could be very slow. If possible, I would recommend you move the query "getAllInvestments" up into the load() in a local variable called investments.
    Then, as users type in the filter try something like this inside the with()
    local!datasubset: if(isnull(BUfilter),investments,index(investments,where(apply(search(BUfilter,_),investments.InvestmentMain.BusinessUnit))))
Children
No Data