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 >> Replacing an attribute in a set of notes
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1186519589

Message started by gregi on Aug 7th, 2007, 4:46pm

Title: Replacing an attribute in a set of notes
Post by gregi on Aug 7th, 2007, 4:46pm

I'm not sure this is the appropriate place for this but it seems like an appropriate action might do the trick.

I imported a spreadsheet that had about 40 student records in it into tinderbox. Everything at first glance went as expected. I ended up with 40 new notes and each note had a new user attribute based on the columns of my spreadsheet. I then went ahead and added other info to the notes. I later noticed that  one of my attributes (date_joined) was incorrect as the date field imported as a number. I should have converted the date in Excel into a text value before importing. This was easy enough to change in Excel. My problem though is that I don't want to reimport all the student records again as I've already added additional info to the notes in Tinderbox.

Here's what I'm wondering might work. Set up a temporary agent to collect all the student records. Create an action that would replace the date_joined field in each note with the correct value. These correct values would either be in a list in another note or I could just import the correct date into another set of notes. For something like this to work though it seems like I would need some way to match student notes to date notes in some type of sequential order. Is this even possible?

Title: Re: Replacing an attribute in a set of notes
Post by Mark Bernstein on Aug 7th, 2007, 5:37pm

Sure, it's POSSIBLE.  But I wonder whether this is worth the effort. It seems to me, you have a couple of good options.

If you haven't made many changes to the student records in Tinderbox yet, you could simply revise the spreadsheet and import again.  That seems easy enough.

Another approach: sort the spreadsheet AND the imported notes by some handy criteria --perhaps student name.  Now they;re in the same sequence.  Make the date a key attribute.  Now, print out the list of names and dates from the spreadsheet, and manually enter them in Tinderbox.  With 40 students, and (I fancy) about 3 students/minute, it will be done before you know it.

If you had 4000 student records needing updating, I'd suggest investing in a fancier solution.

Title: Re: Replacing an attribute in a set of notes
Post by Mark Anderson on Aug 8th, 2007, 12:35pm

Mark's idea #2 could be extended - though read through to the end of this post before you start trying it out.  

Drag all the existing imported notes into a new container 'Bad Import'. Then and re-import the corrected Excel file into a container 'Good Import' - the first step is partly to avoid the second import overwriting or clashing with the first. However you do it, you want 2 sets of each note, each inside a separate container note. It is also assumed 'Bad Import' and 'Good Import are unique names within the TBX. If the latter is not true alter them to make the names unique and amend the following instructions accordingly.

Now make an agent that finds all notes inside container 'Bad Import' and an action that copies date_joined data from the 'Good Import' container:
Query: #inside(Bad Import)
Action: DateJoined = $DateJoined("/Good Import/" + $Name)

...except the latter isn't working. I suspect the x in attribute(x) can't be anything except a literal string - i.e. not an expression.

Oops, I think I've over-reached here. ...Mark B, is that true?  

Still I'll put the idea up here  in case it is do-able with a correction to my code. Assuming it is fixable, once the data transfer is complete, you simply delete the agent, the 'Good Import' container and all its contents. Rename 'Bad Import' to something else.

Title: Re: Replacing an attribute in a set of notes
Post by Mark Bernstein on Aug 8th, 2007, 3:58pm

No, you can't (in Tinderbox 4) replace a note name or keyword with an expression:

    $Name(parent)    <- OK
    $Name(/Home Runs/Bonds)  <-- OK
    $Xpos(42) <-- looks for a note named "42"
    $Name($Path) <-- NO!
    $Name(7*6)  <-- NO!

I am inclined to allow the third example -- that is, a simple attribute reference -- or perhaps both the third and the fourth examples.  Comments and suggestions are welcome.

Title: Re: Replacing an attribute in a set of notes
Post by Paul Walters on Apr 23rd, 2008, 8:52pm

Could you export the "bad" notes, import them into Excel, fix the date problem, then import the whole group back into Tinderbox into a new container?  If they check out, then delete the old notes.

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.