Query Help

54 views
Skip to first unread message

Jasel17212

unread,
Feb 7, 2023, 5:18:20 PM2/7/23
to Ledger
Two questions:

Is there a shorthand way to write the following query?

ledger reg ^exp and expr "has_meta('tag1')" or ^exp and expr "has_meta('tag2')"

Is there a way to group the results of this query by tag?

ledger reg ^exp and expr "has_meta('tag1')" or ^exp and expr "has_meta('tag2')" --group-by ????

Thanks
JL

federico lopez

unread,
Feb 7, 2023, 6:25:54 PM2/7/23
to ledge...@googlegroups.com
On Tue, Feb 7, 2023 at 5:18 PM Jasel17212 <ja...@thelittonfamily.com> wrote:
Two questions:

Is there a shorthand way to write the following query?

ledger reg ^exp and expr "has_meta('tag1')" or ^exp and expr "has_meta('tag2')"


Hi JL, 

Maybe just a little shorter:

reg ^exp and expr "(has_meta('tag1') or has_meta('tag2'))"


John Wiegley

unread,
Feb 7, 2023, 7:08:28 PM2/7/23
to Jasel17212, Ledger
>>>>> "J" == Jasel17212 <ja...@thelittonfamily.com> writes:

J> Is there a shorthand way to write the following query?

J> ledger reg ^exp and expr "has_meta('tag1')" or ^exp and expr
J> "has_meta('tag2')"

You may need to escape it from your shell, but this should do it:

ledger reg ^exp & (%tag1 | %tag2)

J> ledger reg ^exp and expr "has_meta('tag1')" or ^exp and expr
J> "has_meta('tag2')" --group-by ????

--group-by tag('tag1')

John

Jasel17212

unread,
Feb 7, 2023, 7:39:14 PM2/7/23
to Ledger
John,

I'm using zsh so entered:

ledger reg ^exp and "(%tag1 | %tag2)" 

The results were for tag2 only. 


I used the group-by tag as follows:

ledger reg ^exp and expr "(has_meta('tag1') or has_meta('tag2'))" --group-by tag('tag1')

The results was:

zsh: missing delimiter for 'u' glob qualifier


Thoughts on either result?

Randy Josleyn

unread,
Feb 7, 2023, 9:35:44 PM2/7/23
to ledge...@googlegroups.com
On 2/8/23 06:18, Jasel17212 wrote:
> Two questions:
>
> Is there a shorthand way to write the following query?
>
> ledger reg ^exp and expr "has_meta('tag1')" or ^exp and expr
> "has_meta('tag2')"

This seems to work for me:

ledger reg ^exp and expr "has_meta('tag1') | has_meta('tag2')"

Sorry I don't have an answer to the second question. —Randy

John Wiegley

unread,
Feb 8, 2023, 2:08:59 PM2/8/23
to Jasel17212, Ledger
>>>>> "J" == Jasel17212 <ja...@thelittonfamily.com> writes:

J> I'm using zsh so entered:

J> ledger reg ^exp and "(%tag1 | %tag2)" 

Sadly, it has to be more separated than this:


ledger reg ^exp and '(%tag1' '|' '%tag2)'

It's a bug to me that the query parser interprets "(%tag1 | %tag2)"  as if you
had written "(%tag1 |" "%tag2)".

John

Jasel17212

unread,
Feb 9, 2023, 8:10:02 PM2/9/23
to Ledger
Thanks John!
Reply all
Reply to author
Forward
0 new messages