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
Prototype with Display Expression (Read 3478 times)
George Tenedios
Full Member
*
Offline



Posts: 5
Winfield, Pennsylvania
Prototype with Display Expression
Jul 26th, 2015, 1:10am
 
I am new to Tinderbox, trying to do something which should be basic. i developed a prototype. Made the prototype Journal. In actions typed.
Prototype="Journal",format($Date,"l")+": "+$Name)

But to no avail do I get the date  added for new notes that I add to prototype container. i do get the new note as "Journal" tab.
I even tried putting  in Display Expression, format($Date,"l")+": "+$Name), from the Get info box but  I get an error no $Name.
thank you, george tenedios
Back to top
 
« Last Edit: Jul 26th, 2015, 7:37am by Mark Anderson »  
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Prototype with Display Expression
Reply #1 - Jul 26th, 2015, 8:04am
 
[admin note : I moved this to its own thread as it's unrelated to the topic to which added. Giving it a better thread title also helps other forum users find the solution when searching.]

It may be basic, but you forgot to describe what it is you're trying to do!  Wink However, reading between the lines I think you want to create a prototype called "Journal". The prototype's task is to set (only in inhering notes) a Display Expression ($DisplayExpression)that sets the notes $DisplayName to the OS short date format for the user attribute $Date and the $Name. A further assumption is that $Date is a user attribute of Date format. If so, then first we need to fix some code errors. You had:

Prototype="Journal",format($Date,"l")+": "+$Name)

We're missing a $-prefix at the start, have an illegal syntax of a comma mid-way through and unbalanced parentheses - two closing but only one opening. If my starting assumption is correct, you meant to set the prototype's $DisplayExpression. So open the Text Inspector, Title tab. In the Display Expression box enter:

$Date.format("l")+": "+$Name

To stop the display expression running in the prototype itself, select the prototype and open the Text Inspector, Title tab. Un-tick the bottom tick-box 'Display Expression Enabled'. Now the display expression is only run in notes using the prototype.

Then in your action (container $OnAdd or agent $AgentAction):

$Prototype="Journal";

On my (UK locale) Mac, a note called "Test Entry" with a $Date of today (26 July 2015) has a $DisplayName of "26/07/2015: Test Entry". On a US system is will likely appear as "07/26/2015: Test Entry".

I hope that's what you wanted. If I've misunderstood, please re-state the question.

Edited:
Further to discussion later in this thread: the date formats originally used here are correct but the 'code' font used by the forum uses the same glyph character for numeral 1 and lowercase L.  The code .format("l") is a lowercase letter L and not the numeral one.
Back to top
 
« Last Edit: Jul 27th, 2015, 3:58am by Mark Anderson »  

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



Posts: 5
Winfield, Pennsylvania
Re: Prototype with Display Expression
Reply #2 - Jul 26th, 2015, 11:34am
 
I will take your advice about starting a new thread for others. Thank you for your response.
I am trying to place individual note in a container called "Journal"
When I open those notes in the "Journal" Prototype I want the heading of the note to have the name of the individual note but the date and time of the note when it was created. Also I want the note to automatically tab to the "Journal".
Now this is what i did.  
Made  a note called  Journal. CMD 1 into Properties inspector and tick on Prototype

Went to Text inspector and entered; $Date.format(1)+": "+$Name
also unticked 'Display expression'

NOW I AM NOT SURE WHAT YOU WANTED ME TO DO WITH THE CONTAINER OR THE NOTE. I STAYED WITH THE NOTE AND went into Action inspector
and typed $Prototype="Journal";
I pressed enter everytime I added the wording you gave to me. I closed the inspector with cmd 1

I placed a another test note into the Journal note to make a container and 'focus view' on the container to see my test note. The test note did not have the date and an error was generated ' This note's $Display Expression cannot be parsed: No attribute named $Date

Thank you for your valuable time in this matter, george tenedios

Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Prototype with Display Expression
Reply #3 - Jul 26th, 2015, 1:51pm
 
Quote:
I am trying to place individual note in a container called "Journal"
When I open those notes in the "Journal" Prototype I want the heading of the note to have the name of the individual note but the date and time of the note when it was created. Also I want the note to automatically tab to the "Journal".

I'm not 100% sure I understand the above. I read it to mean:

1. I want the container note "Journal" to set a prototype (also called "Journal").
2. I want notes using this prototype to show a display expression of the creation date and title of the note.
3. I want a newly added note to be selected


First the error you report. As there is no $Date system attribute, I assume you had a already created a user attribute called date. The error tells me you forgot to use $Date. However, you last post says you want to use the note creation date in which case you should have used $Created. now to the other bits:

#1. TB will let you make more than one note of the same name but I'd strongly advise a non-export user not to do this to avoid edge-case problems they will lack the experience to fix.  So, either rename your journal container or the prototype. If you rename, the prototype don't forget to change the prototype name you use on your action code.

I'd suggest a layout like this:

Journal                             (container with $OnAdd to set prototype 'pJournal')
   26/07/2015: Test Note     (journal entry using the 'pJournal' prototype)
Prototypes
   pJournal (prototype setting the display expression)

Quote:
NOW I AM NOT SURE WHAT YOU WANTED ME TO DO WITH THE CONTAINER OR THE NOTE. I STAYED WITH THE NOTE AND went into Action inspector
and typed $Prototype="Journal";

When you code in the Action tab for a non-agent note you are setting the $OnAdd, therefore you want to set this for the Container *not* the note you will put in the container. When you put a note into a container that fires the $OnAdd of the container.

Does that make it clearer?

edit: typo
Back to top
 
« Last Edit: Jul 27th, 2015, 3:54am by Mark Anderson »  

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



Posts: 5
Winfield, Pennsylvania
Re: Prototype with Display Expression
Reply #4 - Jul 26th, 2015, 6:31pm
 
Sorry I thought $Date was a System attribute with the date defaulted to the  time and day and year  the note was created. Now I am struggling with creating a User attribute for $Created and or $Date. Let me work on that myself looking through your reference material. thank you, george tenedios
Back to top
 
 
  IP Logged
George Tenedios
Full Member
*
Offline



Posts: 5
Winfield, Pennsylvania
Re: Prototype with Display Expression
Reply #5 - Jul 26th, 2015, 10:03pm
 
Almost ready to Yell Uncle, I now have the note to follow  the format Date plus name of note when it goes into p_Journal. A big But!! However, I get Never:Name of note. Never has been substituted for a date. Where did I go wrong.
thank you ,,, george tenedios
Back to top
 
 
  IP Logged
George Tenedios
Full Member
*
Offline



Posts: 5
Winfield, Pennsylvania
Re: Prototype with Display Expression
Reply #6 - Jul 26th, 2015, 10:49pm
 
Got it to work, thank you, Change the ("1") to the letter ("l"). 1 to the small letter L.
$Created.format("l")+": "  +$Name
Looked in http://www.acrobatfaq.com/atbref5/index/Attributes/, date format uses the number one, I could not find what "l" indicates. thank you george tenedios
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Prototype with Display Expression
Reply #7 - Jul 27th, 2015, 3:53am
 
The list of date formats at aTbRef is correct. Lowercase 'L', i.e. 'l', is the code for the locale's 'short' date.  If you look elsewhere on that page you'll see the figure '1' looks slightly different:



I've always felt lowercase L was a bad choice for the reason arising here. In many typefaces there is little - sometimes no - difference between l and 1.

Anyway, I've edited the aTbRef date format page with extra text to clarify the l-vs-1 issue. I've also edited any of my posts upthread which were using code copied/pasted from your original post.

I'd close by saying my comments in this post aren't meant rudely. You've flagged up an easily made error that's worth illuminating for other readers of this thread.

edit: I checked and I did use the correct character for the date format (at least my memory is not going!). The problem is the 'typewriter' markup used to indicate code sections uses a very similar glyph for l and 1 (e.g. ( l 1).
Back to top
 
« Last Edit: Jul 27th, 2015, 4:01am by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Prototype with Display Expression
Reply #8 - Jul 27th, 2015, 10:13am
 
The data format "l" stands for "local" or "locale".

Back to top
 
 
WWW   IP Logged
Pages: 1
Send Topic Print