Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for strings and numbers in formulas #43

Open
FredD opened this issue Feb 9, 2022 · 3 comments
Open

Support for strings and numbers in formulas #43

FredD opened this issue Feb 9, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@FredD
Copy link

FredD commented Feb 9, 2022

Tony Grosinger

Thanks for the wonderful Advanced Table plugin. I have two requests which would make it even more wonderful for me.

The requests have to do with the formula functionality, which makes this plugin so useful for me.

The ability to add a raw number into a formula. Currently, it seems in order to reference a value you need to have it in the table. For instance, to divide a number, you need to have the divisor somewhere in the table.

The ability to add string literals into the outcome of a function (24 hours) (16 minutes)

Many thanks for this plugin, I use it every day

@FredD FredD added enhancement New feature or request needs-review labels Feb 9, 2022
@tgrosinger tgrosinger transferred this issue from tgrosinger/advanced-tables-obsidian Feb 9, 2022
@tgrosinger tgrosinger changed the title Formula feature requests Sup\rt for strings and numbers in formulas Feb 9, 2022
@tgrosinger tgrosinger changed the title Sup\rt for strings and numbers in formulas Support for strings and numbers in formulas Feb 9, 2022
@agnoldo
Copy link

agnoldo commented Mar 30, 2022

+1

Totally agree with the amazingness of Advanced Tables and with the usefulness of this idea. With string concatenation, it's possible to create dynamic links to web pages, for example. Suppose you have an id in the first column and a country name in the third column: with string concatenation we can create a last column with links to the object (using id) and to the country in any web app (Wikipedia, for example) using the country name.

Thanks for the great work!

@cthulhubuddha
Copy link

+1 also. Would it be possible to, for example, sum the values of a column but format the cell to read Sum:: ? And if so, would I then be able to use dataview to select that value from multiple notes? So for example, if I have a folder of author notes, each author note has a table of the book titles i own and their value, i can currently sum the value of the books per author note. But i haven't been able to figure out how to take the sums from each note and provide a total collection value. If each note's tables can have a Sum:: that comes from advanced tables formula that supports strings that might allow dataview to pick up that field for each note to sum all of them. Also, there may be a way easier way to do what i'm thinking. Thanks either way!

@weltenwort
Copy link

The ability to add a raw number into a formula. Currently, it seems in order to reference a value you need to have it in the table. For instance, to divide a number, you need to have the divisor somewhere in the table.

@FredD, just to make sure you're aware: You can use constant numbers (called real and float in the grammar) in the formula:

source ::= range | source_reference | single_param_function_call | conditional_function_call | algebraic_operation | float | real

What tripped me up at first is the fact that every arithmetic operation in infix notation needs be surrounded in parentheses:

algebraic_operation ::= "(" source " "? algebraic_operator " "? source ")"

So @2$2=@2$1*0.5 can't be parsed, but @2$2=(@2$1*0.5) should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants