Forum Discussion
Richard_Mayo
2 years agoNew Contributor III
Where text field is not blank (data buffer)
Good morning all!
I'm hoping somebody can put me on the right path...!
I'm writing a rule with a data buffer. I want to filter the data buffer so it only runs where needed.
I put in the followi...
- 2 years ago
I see. Yeah my version is probably a bit more efficient. The other bit I would try to optimize is the lookup of the Text variable, with some sort of dictionary acting as a cache - so that we do the actual lookup only once. Roughly:
' outside the loop. Dim AccTextCache as new Dictionary(Of Integer, String) For each cell in yourBuffer ' If you've not filtered your buffer already to contain only interesting cells, ' do your work here, then... ' try to get text from cache Dim accText as String = AccTextCache.XFGetValue(cell.DataBufferCellPK.AccountID, Nothing) if accText is Nothing then ' not found in cache, need to look it up ... ' note: prefer api. methods over brapi. ones, they are faster accText = api.Account.Text(cell.DataBufferCellPK.AccountID, 6, scenarioTypeId, timeId) ' ... then store it in our cache AccTextCache.Add(cell.DataBufferCellPK.AccountID, accText) end if ' rest of the work here next... but the value of this effort may or may not be significant, only benchmarking would tell.
I'd also try to get rid of any call to .GetAccountName and similar. Stick to IDs everywhere.
RobbSalzmann
2 years agoValued Contributor II
Hi Richard_Mayo ,
Where(Text6 <> '') should work. I can't tell if you have a space between your quotes, you shouldn't.
- JackLacava2 years ago
OneStream Employee
Doesn't work for me in 7.4.2, generally i've not seen Where used with FilterMembers.
- RobbSalzmann2 years agoValued Contributor II
Hmm, this gets pretty confusing. Screen shot below is 7.3.1. This is what leads me to use XFBR instead of the less-than-fully functional member filter builder. When I write code I have full access to the language and its operators.
- JackLacava2 years ago
OneStream Employee
I mean, the syntax is valid (as he says, in Cube Views it's fine), it just doesn't work for me inside FilterMembers. It's not the first time that I see complex filtering not working within FilterMembers, it might be just bugs but I simply tend to work around it. GetMembersUsingFilter tends to be more robust.
Related Content
- 3 years ago
- 2 years ago