2

I have created a branch template [Comparison Chart] which contains a folder item called [Headers] which is designed to contain items of the template [CChart Header].

Inside the [Comparison Chart] item, on the same level as the headers folder will be items of [CChart Row] template which has a droplist field called [Selected Headers]. I would like the [Selected Headers] field to be populated with any/all items inside the [Headers] folder, but I do not know how to setup the field to have a relative datasource.

Here's a visual representation of the tree structure:

Comparison Chart ([Comparison Chart] item)
     Headers (folder)
          Blue ([CChart Header] item)
          Red ([CChart Header] item)
          Green ([CChart Header] item)
     Volkswagons ([CChart Row] item)
     Fords ([CChart Row] item)
     Toyotas ([CChart Row] item)

Eventually, I will spit out a table similar to the below, but I can't figure out how to set the datasource so that authors can select which headers apply to which rows:

The manufacturers produce cars in the colors indicated below
               Blue     Red     Green
Volkswagons     X        X        X
Fords                    X
Toyotas         X                 X
2

[CChart Row] template would have Multilist field instead of Droplist as you want to select multiple [CChart Hearder] items like blue, red green while Droplist will allow to select only one of these.

Reg datasource query, you can use any of the below

  1. query:../Headers/*
  2. query:./ancestor::* [@@name=‘Comparison Chart]/Headers/*
  • I would swear that I tried this yesterday and it wasn't working for me, but it's definitely working now. Thank you for your answer! – Michael Sep 5 '18 at 21:48
2

You can use something like this in your template field source (You would need to change the templateid value to be the actual ID of your comparison chart template ID ):

query:./ancestor-or-self::*[@@templateid='{Comparison Chart Template ID}']/Headers/*

Or another way using the parent folder name

query:./ancestor-or-self::*[@@name='Comparison Chart']/Headers/*

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.