Hi - the scope of a “agent” designator is limited to the $Query of the agent but I would like to access an attribute of the agent in my export template.
The attribute is $CurrentDeveloper (String) and the export code needs the value of this attribute to select specific childs of a parent note to calculate the sum of an attribute of those childs.
It doesn’t. I tested $CurrentDeveloper(parent) - returns exactly the string I need… but still the find doesn’t work as if I use the string in double quotes… must be something easy…
At this point the smart thing to do is take a pause and dump out, to $Text or attributes, the values for $Developer and $CurrentDeveloper(parent). If necessary, copy content out to a code editor or BBEdit or the like and look for oddities like non-printing characters (e.g. a trailing line break). This step always feel like extra work when one might just think ‘think’ a solution. But strings that don’t behave as they should often aren’t quite the strings we assumed them to be!
I did - I wrote $CurrentDeveloper(parent) to $MyString and used value($MyString) to write out the value - the string is there. Copied everything to Bbedit and back to TBX… still doesn’t work…
doesn’t do the job: <tr><td>^title^^value($CurrentDeveloper(parent))^2</td><td>^action($MyString=$Text.replace ("\n"," "))^^value(MyString )^</td><td>^action($MyNumber=sum_if(children,$Developer==$CurrentDeveloper(parent),$Storypoints);)^^value($MyNumber)^</td></tr>
another failed try: <tr><td>^title^^action($Text(parent)=sum_if(children,$Developer==$CurrentDeveloper(parent),$Storypoints))^</td><td>^action($MyString=$Text.replace ("\n"," "))^^value(MyString )^</td><td>^value($Text(parent))^</td></tr>
and - this one will do it: <tr><td>^title^^action($Text(parent)=sum_if(children,$Developer=="Ted Lasso",$Storypoints))^</td><td>^action($MyString=$Text.replace ("\n"," "))^^value(MyString )^</td><td>^value($Text(parent))^</td></tr>
You can view this in export & preview modes to look for possible differences.
Do all aliases fail the comparison, or only some? Might there be something in the actual values being compared (e.g. characters that can also be regex characters, etc.). But with this sort of problem you really need to see the values, The rest of the template code, at this point, is just an annoyance. Pare back to get a really simple test so as to have as few additional possible factors as possible. Though I don’t think (yet) that it is so here, it could be something else in the template going awry. Only by tearing down so small tests can one easily flush the error out.
Can you make a small file that shows the problem? Or I’m happy to look at the file privately if that help (in which case send me a forum message).