Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
I'm currently developing a new APP template using only Javascript/FOM. In the past, we used specific counters like f or g to count page numbers or footnote references. The reason those counters come into handy is their behaviour when a page is reformatted multiple times as they still count correctly.
I want to avoid using legacy functionality whenever it is possible and tried using a global JavaScript variable like template.myCounter to count footnotes throughout the formatting process. As a ordinary global variable (like 3B2 Script or Perl Variable), incrementing it during formatting, will just add up, if an element is reformatted multiple times. Therefore a page with a single footnote that is formatted 4 times, would result in template.myCounter+4 instead of +1.
What would be the best practice in those situations (footnotes, page number)? Using counters with the formatting.evaluateShowString() function? Does the FOM provide any information about retries?
Solved! Go to Solution.
Hello Hubert,
It would depend on the version of APP you are using for some areas, but you can still access counters through FOM if you wanted to.
formatting.counters[1] //(xcounter 1 in this case)
Alternatively JS variables are formatting safe unlike traditional global variables, so using a 'template.footnoteCounter' template specific global variable should be fine.
V11.1 page events, display objects or just the formatting log may give you some info on your footnotes.
(Datacopy and tformat have a APP JS FOM API training course for new and existing users if it is of interest)
Best Regards
Chris
www.tformat.com
Hello Hubert,
It would depend on the version of APP you are using for some areas, but you can still access counters through FOM if you wanted to.
formatting.counters[1] //(xcounter 1 in this case)
Alternatively JS variables are formatting safe unlike traditional global variables, so using a 'template.footnoteCounter' template specific global variable should be fine.
V11.1 page events, display objects or just the formatting log may give you some info on your footnotes.
(Datacopy and tformat have a APP JS FOM API training course for new and existing users if it is of interest)
Best Regards
Chris
www.tformat.com
Hi Chris - I think you'll find that template.footnoteCounter will not be format safe as a variable. It would be safe(er) to use formatting.counters[] or formatting.fish[] to track these things. I will take a note about making the other counter types available through FOM and work with R&D to get them implemented.
Simon
Hi Simon,
OK should have said it would work in the sense that js vars are not bi-directionally populated like traditional global vars are
You can already use the counter constants like formatting.counters[ fFormatting.COUNTER_A ]; .
Thanks
Chris
Specifically regarding Javascript variables, some changes were made during the 10.0 release stream that improved the use of Javascript global variables. JS globals are now "format safe" meaning you can use them for certain format purposes. Note that variables attached to objects (e.g. myObject.myVar) are NOT format safe. Note also that JS objects or JS arrays are not format safe.
I recommend you have a play with JS global variables in a demo/test file in various situations to see if they work for your purposes.
Hi Hubert,
Just checking to see how this is going on your end. Did you have any follow-up questions for the Community?
Hi Rafael,
the first solution suggesting the use of xcounters with formatting.counters[x] works perfectly fine for this case as they are "format safe". I've also marked the first answer as the correct one now.
Thanks to everyone for your help.