Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Agents and back references (Read 1772 times)
David Bertenshaw
Full Member
*
Offline



Posts: 182

Agents and back references
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.
Back to top
 
« Last Edit: Apr 06th, 2016, 2:39pm by David Bertenshaw »  
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Agents and back references
Reply #1 - 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.

Edited:
Edited to remove reference to something that is an interim glitch (now being fixed).
Back to top
 
« Last Edit: Apr 7th, 2016, 2:35pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
David Bertenshaw
Full Member
*
Offline



Posts: 182

Re: Agents and back references
Reply #2 - 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
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Agents and back references
Reply #3 - Apr 6th, 2016, 4:27pm
 
I see the problem with back-references in agents. Should be addressed in b200.
Back to top
 
 
WWW   IP Logged
David Bertenshaw
Full Member
*
Offline



Posts: 182

Re: Agents and back references
Reply #4 - Apr 6th, 2016, 5:17pm
 
Cheers Mark.

Do you still need an email or do you have enough information now?
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Agents and back references
Reply #5 - Apr 6th, 2016, 5:48pm
 
Nope -- we've got the problem and added an automated test to keep a watchful eye on it.
Back to top
 
 
WWW   IP Logged
David Bertenshaw
Full Member
*
Offline



Posts: 182

Re: Agents and back references
Reply #6 - 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!
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Agents and back references
Reply #7 - 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.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Pages: 1
Send Topic Print