Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Agent, Actions, Rules & Automation >> Agents and back references
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1459967651

Message started by David Bertenshaw on Apr 6th, 2016, 2:34pm

Title: Agents and back references
Post by David Bertenshaw on Apr 6th, 2016, 2:34pm

After some time away I've started using TBX 6.5 and I can't get them to work any more. I'm following my old notes and having no luck with something that used to work well. It's perfectly possible (likely...) that I'm just missing something obvious, but for the life of me I can't see what it is...

Setup - an imported note with many paragraphs each of which contains a location number in the form <location>999</location> (for example). I explode the note and want to use an agent to populate the pre-existing attribute $Location.

What I have:


Code:
Query: inside("exploded notes") & Text((<location>)(.*)(</location))
Action: $Location=$2


What I'm getting is that every note gets the same value entered into $Location -- that is, they all get the value taken from the first match. There are no other agents -- this is a blank file created for test purposes.

I'm obviously forgetting something obvious...

EDIT: I can work around this of course with a stamp and


Code:
if(Text((<location>)(.*)(</location>))) {$Location=$2}


I'd just like to know why the agent isn't working.

Title: Re: Agents and back references
Post by Mark Anderson on Apr 6th, 2016, 4:05pm

I can replicate this in v5.12.3 and v6.5.0. In v5, I updated the query to use the non-deprecated of your code. Thus:


Code:
Query: inside("exploded notes") & $Text.contains("(<location>)(.*)(</location)")
Action: $Location=$2

Anyway, I get a result as you describe. The above query code also works in v6:


Code:
inside("exploded notes") & $Text.contains("(<location>)(.*)(</location>)")


However, I concur that the action is not refreshing the backreferences for each alias but is re-using the value extracted from the first alias query match. Why, I'm not sure. This is one for Eastgate.

Regardless of the backreference issue, I recommend that as you review your query/action code fordepreacted usage.

[edit]Edited to remove reference to something that is an interim glitch (now being fixed).[/edit]

Title: Re: Agents and back references
Post by David Bertenshaw on Apr 6th, 2016, 4:13pm

Thanks for the quick reply, Mark. Got to go out now, but I'll send an email to Eastgate in the morning re the back reference issue. Cheers

Title: Re: Agents and back references
Post by Mark Bernstein on Apr 6th, 2016, 4:27pm

I see the problem with back-references in agents. Should be addressed in b200.

Title: Re: Agents and back references
Post by David Bertenshaw on Apr 6th, 2016, 5:17pm

Cheers Mark.

Do you still need an email or do you have enough information now?

Title: Re: Agents and back references
Post by Mark Bernstein on Apr 6th, 2016, 5:48pm

Nope -- we've got the problem and added an automated test to keep a watchful eye on it.

Title: Re: Agents and back references
Post by David Bertenshaw on Apr 7th, 2016, 3:43am

Ok - thanks.

And thanks to Mark A for the info on the deprecated code. I used Text() because $Text.contains didn't work and I couldn't work out why. You've explained it very nicely -- thanks!

Title: Re: Agents and back references
Post by Mark Anderson on Apr 7th, 2016, 2:37pm

I've amended my earlier post as in testing the backreference issue (already diagnosed) I tripped over another issue (also being fixed). So, the (updated) v5 code also works in v6. The back-references from an agent action will too, in the next release.

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.