Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
accessing list within container
Renata
hello,
I am trying to display a list of links as defined by a user with this dct:
<container name="multi_links" combination="and">
<label>Links List</label>
<item name="links">
<label>Link</label>
<replicant min="1" max="6" combination="and">
<item name="label" >
<label>URL Label</label>
<text required="f" size="40"/>
</item>
<item name="url" >
<label>Link URL</label>
<browser initial-dir="." />
</item>
</replicant>
</item>
</container>
I have tried doing it in <iw_perl> with both iwpt_dcr_value(dcr.multi_links.links) and iwpt_dcr_list(dcr.multi_links.links) and it doesn't work.
I am calling this dcr with iw_load_dcr()
can someone point me n the right direction on how to access my replicant entries?
thank you
Find more posts tagged with
Comments
Adam Stoller
When you use replicants (and/or containers with min/max values as in TS6) you need to include the index value of the replicant (as if it were an array) when providing the address to these calls.
In your case, I believe it would be
iwpt_dcr_value('dcr.multi_links.links
[0]
.links');
(
note: I'm not looking at documentation or any of my existing code right now - I believe the values are zero-based, but they might be one-based - if so, change the '
[0]
' above to '
[1]
'
)
In the second case - if you want to iterate through all the elements in your replicant, I think it should be:
iwpt_dcr_list('dcr.multi_links');
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
Renata
fish,
thanks for your help,
now I can access individual instances:
my $link = iwpt_dcr_value('item_1.multi_links.links[0].label')
or
my $link = iwpt_dcr_value('item_1.multi_links.links[0].url')
(the index is 0-based)
to loop through the whole list, I tired to use the length() function, and it continuously returns 1,
I've tried both:
my $num =length( iwpt_dcr_list('item_1.multi_links'))
and
my $num =length( iwpt_dcr_list('item_1.multi_links.links'))
they both return 1, even though I have 3 entires for my links and I can fetch all 3 using the above code.
thanks for you help.
Adam Stoller
You might have to use a .* on the end in order to do the list part - The documentation should provide some examples (the on-line docs do so, especially)
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com