Forum Discussion

FICO's avatar
FICO
Community Manager
17 years ago

Access value holder of code template which is included in template list

Access value holder of code template which is included in template list

Hi

I created one code tempalte  inside that one template list is included which holds 3 code tempalte. As follows:

Codetemplate1Level1-> 

             Code TemplateList->

                                           CodeTemp1-VH1

                                           CodeTemp2

                                           CodeTemp3

Codetemplate2Level1-> 

                in SRL content i want to access VH1.

When I placed place holder using global template it gives me <Bad Referance> or <Unresolved Referance>.

Kindly suggest me how i can avoid this error?

Regards,

Archu

2 Replies

  • FICO's avatar
    FICO
    Community Manager

    It is not possible to create a reference to a valueholder in a (code) template through a template list provider. What happens is that the template list provider can contain any one of the templates listed, so that a reference to something within a template provided by the template list provider might not resolve.

    You need to find another solution for this, plain and simple. How you could solve it depends on your problem

    Regards,

    Jostein

  • FICO's avatar
    FICO
    Community Manager

    The only way would be to move the VH1 to your top level template and then pass it to the lower level template as an argument. So in Codetemplate1Level1 it would be a real value holder, and in the CodeTemp1 you would change its multiplicity to "Single Argument". Then in the Codetemplate1Level1 in the value holder that points to your template list provider you would need to add a dynamic argument override, call it "VH1" and point to the VH1 value holder. This way the provider would be able to pass its value to the underlying CodeTemp1 when it is selected.

    Doing the other way around is not possible because when template other than CodeTemp1 is selected in the template list provider, the VH1 does not exist and the system cannot figure it out on its own. You can implement your own custom provider that would be able to retrieve the value using repository APIs (or substitute something when it is not defined), but as Jostein suggests, there should be an easier solution to what you are trying to do. Custom providers should be the last resort.