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

Dynamic Arguments to <call> Tag #224

Open
ssc2015 opened this issue May 1, 2017 · 3 comments
Open

Dynamic Arguments to <call> Tag #224

ssc2015 opened this issue May 1, 2017 · 3 comments
Labels

Comments

@ssc2015
Copy link

ssc2015 commented May 1, 2017

One of the comments in an earlier issue (How do I chain replies) mentioned that setting a variable by calling a macro, like below, is a harder problem to solve.

<set myResult=<call>...</call>>

Is there any update on this? We need a way to pass a dynamic date parameter to the <call> tag.

@kirsle
Copy link
Member

kirsle commented May 1, 2017

You can set user variables from inside the macro if that works.

rs.setUservar(rs.currentUser(), "myResult", "x");

@kirsle kirsle added the question label May 1, 2017
@ssc2015
Copy link
Author

ssc2015 commented May 2, 2017

@kirsle, I have tried the following but the args in the sub are empty.

Is this because "get" is evaluated before calls are processed?

! version = 2.0

+ test
- <call>date</call> <call>sub <get date></call>

> object date javascript
rs.setUservar(rs.currentUser(), "date", new Date().toString());
< object

> object sub javascript
console.log(args);
return "Args: " + args.join(',');
< object

@kirsle
Copy link
Member

kirsle commented May 2, 2017

Yeah the <call> tag is always the very last one processed. You could use rs.getUservar() inside the macro to get the variable too.

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

No branches or pull requests

2 participants