Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Exporting from Tinderbox >> noob has the urge to export ...
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1308342972

Message started by Sam Dave on Jun 17th, 2011, 4:36pm

Title: noob has the urge to export ...
Post by Sam Dave on Jun 17th, 2011, 4:36pm

I've been playing around with Tinderbox for about a week and been really pleased with the progress I've made so far (thanks in large part to the help I've received on the Forums).

I'd like to make a start learning about exporting but try as I might - reading various documentation sources and others' questions on the Forums - I'm somewhat confused.

Let's start really simple (he said, hopefully). I have a note which has processed some data for me. The results of that processing are now stored in an attribute in that note. (It's a list attribute called $phraseString).

I'd like to export the value of that attribute to a text file. I don't need it in HTML, just good ol' plain text (it's heading for a word processor. When I'm more experienced in Tinderbox I'll probably leave it where it is, and do more work on it there, but for the moment this seems like a good opportunity to start learning about export).

I don't want to export anything else (from that note, or any other). Just the value of that single note's single attribute.

OK, so based on what I think I've read, I'll need a thing called a 'template' and that will include the code ^value($phraseString)^

But I don't know if I need anything else, I'm not sure where to put that template, and I'm not sure how to proceed. (I assume that when I go to FILE>>>EXPORT AS TEXT, I get the chance to select my template?)

If anyone could help me out, I'd be very grateful.

Thank You.

Title: Re: noob has the urge to export ...
Post by Mark Anderson on Jun 17th, 2011, 5:14pm

To export an attribute, ^value($MyAttribute)^ in your template is the route to go, but be aware of formatting issues. Re $phraseString, note this on attribute naming best practice.

To make a note into a template, see about $IsTemplate and more here.

Title: Re: noob has the urge to export ...
Post by Sam Dave on Jun 18th, 2011, 4:07am

Superb.

Thanks, Mark. I especially appreciate you taking the trouble to answer that one at 22:14 on a Friday.

I now have a text file containing my attribute (a list of phrases separated by semi-colons.) I'm sure there's more I could learn about inserting line breaks within Tinderbox but for now I can do all that in a word processor easily enough.

Now that you've given me the basic mechanics of creating/using a text export template, my next step is to play around with extracting other stuff in text format.

Your point about attribute naming is useful, too. Definitely a hangover from my other coding efforts where I'd capitalise class names and use lower camel case for properties. Funny - even as I was naming attributes in that way in Tinderbox some part of me was thinking, Mmm, I'm not sure they do it that way round here.

Thanks again.

Title: Re: noob has the urge to export ...
Post by Mark Anderson on Jun 18th, 2011, 7:33am

Sounds like you're exporting a List or set type of attribute.  Look at the .format() function for those data types. You can either concatenate or provide list & litem prefix/suffix formatting.

Title: Re: noob has the urge to export ...
Post by Sam Dave on Jun 18th, 2011, 8:37am

Now you're just spoiling me.  :)

You're right - I'm exporting a list.


Code:
^value($phraseCollection.format("\n"))^


worked perfectly.

Thank You.

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.