Hi Tobias,

I'm finally getting back to this.

Here's a simple Javascript macro that displays the value of three 
parameters and the results of a comparison to a constant:


/**
 * Created by afinger on 2/24/2015.
 */
/*
Macro to build search string from section and company parameters
*/

(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Information about this macro
*/
exports.name = "build_search_string";
exports.params = [
    {name: "section", default: "Any"},
    {name: "source", default: "Any"},
    {name: "text", default: ""}
];
/*
Run the macro
*/
exports.run = function(section, source, text) {

    var foo= "|" + section + " | " + source + " | " + text + " |\n" + "|" + 
(section == "Any" ) +  " | " + (source == "Any") + " | " + (text == "") + " 
|\n"
    return foo
};
})();

Invoking it from a WikiText macro:

\define ShowResult()

<<build_search_string  {{$:/.af/SearchBy/params!!section_sel}}  
{{$:/.af/SearchBy/params!!source_sel}} 
{{$:/.af/SearchBy/params!!searchtext}} >>


\end
{{$:/.af/SearchBy/form}}
<<ShowResult>>

It always shows the correct value but the comparison is always false.


If I replace the transclusions with constants, it works correctly. What's 
going on?

Alan




On Wednesday, January 28, 2015 at 7:02:16 PM UTC-5, Tobias Beer wrote:
>
> Looks like a good place to use a javascript macro...
>>
>
> That may indeed be a viable way to achieve this...
>
> *#1427 allow text-references and variables anywhere in a filter expression*
> https://github.com/Jermolene/TiddlyWiki5/issues/1427
>
> @Jeremy, (how) can a js macro acces a variable number of parameters?
>
> Best wishes, Tobias.
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to