Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Accessing replicants in formAPI and in a TPL
System
Hey,
I am writing a presentation template, and came across what seems to be some inconsistency to me, and wanted to make sure that nothing is wrong with my code.
Consider a situation where you have a container called X with replicants defined for it (min = 1, max = 20).
When I access the first replicant of X in formAPI I do so by writing X[1].
When I access the first replicant of X in a TPL I do so by writing X[0].
It seems like the index for the first replicant changes between the TPL and formAPI.
Is this really the case?
Thanks,
Ido
Find more posts tagged with
Comments
Adam Stoller
I believe that is correct - javascript uses 1-based arrays and PTs use 0-based arrays
Migrateduser
Yes, but it's not such a strange thing. Perl and Javascript are two different languages and although it would be nice if there were some universal standard with programming languages when marshalling arrays but there is not, although most tend to adhere to an array originating with element zero.
jbonifaci
Actually, javascript uses 0 based arrays as well. What he's refering to his the item xpath. I'm not sure if there is some standard around this that it should be 1 based? If not, I think the iwov guys were on crack when they made the replicant intances 1 based.
ravio
Or maybe they were on a lot of caffine and highly alert so as not to call a replicant instance as '0'th instance.
Probably from the end users perspective, calling a first replicant as first and not '0'th makes more sense
;-)
Migrateduser
Agreed but it still deviates from common practice of the first element being number "0".