Skip to content

The second argument in the <%QUERYBUILDER%> command fails when a var is passed instead of a hard-coded value #208

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

Closed
mdroidian opened this issue Dec 27, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@mdroidian
Copy link
Collaborator

Steps to repo:

- #SmartBlock bugGetSelectionsFromQueryBuilderCommand
    - ^^Set the default vars for the query^^
<%SET:queryAlias,Active-Projects%>
<%SET:querySelection,text%>
<%NOBLOCKOUTPUT%>
    - ^^Various ways the second arg could be passed to the `<%QUERYBUILDER%>` command^^
<%SET:varNoBrackets,<%QUERYBUILDER:queryAlias,querySelection%>%>
<%SET:varWithBrackets,<%QUERYBUILDER:queryAlias,{querySelection}%>%>
<%SET:getVarWithBrackets,<%QUERYBUILDER:queryAlias,{<%GET:querySelection%>}%>%>
<%SET:getVarNoBrackets,<%QUERYBUILDER:queryAlias,<%GET:querySelection%>%>%>
<%SET:hardCoded,<%QUERYBUILDER:queryAlias,{text}%>%>
<%NOBLOCKOUTPUT%>
    - ^^Outputting the results of each command above. Only the **hard-coded** will output correctly^^ <%NOBLOCKOUTPUT%>
    - <%GET:querySelection%>

    - **varNoBrackets**: <%GET:varNoBrackets%>
**varWithBrackets**: <%GET:varWithBrackets%>
**getVarWithBrackets**: <%GET:getVarWithBrackets%>
**getVarNoBrackets**: <%GET:getVarNoBrackets%>
**hardCoded**: <%GET:hardCoded%>

Reported by Chris H. via slack

@mdroidian mdroidian added the bug Something isn't working label Dec 27, 2023
@mdroidian
Copy link
Collaborator Author

<%QUERYBUILDER%> args are delayed.

delayArgs: true,

This allows the SmartBlock commands to be used on the output of <%QUERYBUILDER%>

eg: <%QUERYBUILDER:myQueryBlock,Random Block from {text}: <%RANDOMBLOCKFROM:{uid}%>%>

To pass a selection as a variable, one can use the "block reference as arg" feature (to be documented), and pass in the column name variable like this: <%GET:<%GET:columnNameVar%>%>

eg:

- My Smartblock #SmartBlock
  - <%SET:columnNameVar,data%>
  - <%QUERYBUILDER:myQuery,((ITe51brrn))%>

block ITe51brrn:

- <%GET:<%GET:columnNameVar%>%>

Reference: RoamJS/smartblocks#120

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

1 participant