20 points reedciccio 1 hour ago 14 comments
shevy-java 1 hour ago | parent
prev_balance = PREVIOUS(rec, order_by="Date").Running_Balance or 0
prev_balance + $Amount
It's such a strange mix-up of stuff. PREVIOUS() is a macro or looks
like one, right? But it is a function call assumingly. But then what's
with .Running_Balance? Guess that also ties into a function. But why
use different syntax for essentially the same thing? It seems rather
weird to write code like that. What would the python variant be like?
Or a DSL?The syntax strangeness continues:
rates = Rates.lookupRecords(Person=$Person, order_by="Rate_Start")
rates.find.le($Date).Hourly_Rate
Does that really convey most easily what is wanted? It seems needlessly
verbose. Why would it require both $Person and $Date? Should that not
be easier to figure out in its own right? Is that efficient?People need to remember that mentally, unless they use AI.
paulfitz 1 hour ago | parent
PREVIOUS returns a record, then .Running_Balance pulls out one field of it.
whizzter 1 hour ago | parent
librasteve 57 minutes ago | parent
chii 1 hour ago | parent
I reckon it makes more sense to return a table, and then have an index lookup in that table: e.g., index(PREVIOUS(blah_blah), column). Then you can also use an indirection to choose which column from another cell if desired.
This is how google finance in sheets returns some data (like exchange rates, iirc).
whizzter 1 hour ago | parent
The root issue is that there's almost 50 years of spreadsheet syntax to consider and not colliding with.
librasteve 53 minutes ago | parent
librasteve 1 hour ago | parent
All feedback good and bad v welcome.
WillAdams 40 minutes ago | parent
librasteve 28 minutes ago | parent
oh and omasheet is Rust and uses Polars so I am working with that rather than NumPy SciPy
seemaze 57 minutes ago | parent
halo 47 minutes ago | parent