any suggestions for improving the performance with this page.onVisible code.
Utlimately it creates a collection (currently with 115 rows) and for each row it’s calling a sql table via an on-prem gateway when it makes the reference to the _h: code…
I personally don’t have much of a performance hit but others do…
I’m not sure what I code do to make it more efficient…when it hits DictHotelV there are over 200k rows but it’s doing an = filter so I thought that was pretty efficient.
With(
{
_c: ForAll(
GroupBy(
Filter(
RFPComments,
!IsBlank(RfpID)
),
RfpID,
GroupedItems
),
With(
{
_top: First(
Sort(
GroupedItems,
Modified,
SortOrder.Descending
)
)
},
{
RfpID: RfpID,
Comment: _top.Comment,
Modified: _top.Modified,
Who: _top.'Modified By'.DisplayName,
Count: CountRows(GroupedItems)
}
)
)
},
ClearCollect(
RFPListing,
ForAll(
Filter(
HotelRFP,
rfpYear = gblRfpYear
) As _p,
With(
{
_h: LookUp(
DictHotelV,
id = _p.sqlID
)
},
With(
{
_mrc: LookUp(
_c,
RfpID = _p.ID
)
},
With(
{
_LastTouched: If(
IsBlank(_mrc.Modified),
_p.Modified,
If(
_mrc.Modified > _p.Modified,
_mrc.Modified,
_p.Modified
)
)
},
Patch(
_p,
{
Status: If(
IsBlank(_p.statusID),
"Unknown",
LookUp(
RFPLookUp,
ID = _p.statusID,
Title
)
),
HotelID: _p.Title,
CommentWho: _mrc.Who,
CommentCount: _mrc.Count,
Comment: _mrc.Comment,
CommentDate: _mrc.Modified,
LastModified: _p.Modified,
PropertyName: _p.propertyName,
MetroCityCode: _h.metroCityCode,
CountryCode: _h.countryCode,
ChainName: _h.chainName,
ChainCode: _h.chainCode,
BrandName: _h.brandname,
LastTouched: _LastTouched,
Aged: DateDiff(
_LastTouched,
Now(),
TimeUnit.Days
)
}
)
)
)
)
)
)
);