We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10313
    • 375 Posts
    Hello,

    I’m just trying to set up some kind of an emergency plan. This means I want to show on my site wich doctor gives emergency service at wich date. For this I set up a template called "doctor" with a set of TV. The doctor’s name is stored as pagetitle.

    Now I set up another template called "emergency" with 3 TVs, namely doctor, startDate, endDate. At first step I fed the TV doctor via @SELECT and that works very fine.

    @SELECT pagetitle, id from prefix_site_content where parent=78


    But now I stumbled on some anomaly in the emergency service plan. Some doctors share their service with a different doctor. This means for example: every time when doc 1 is on duty, doc 31 is on duty too.

    That’s why I added a TV "group" to my first template "doctor" which just holds a letter (A through Z). Normally, each single doctor has a unique letter assigned to it. But doc 31 got the same letter as doc 1 so that they build a small group.

    All clear so far? wink

    Now I must change my second TV "emergency" so that the TV "doctor" is not longer fed by the @SELECT posted above. It must now be fed by all the groups resp. letters I used in the TV "group" of my first template.

    I hope i have explained clearly what the goal is. Actually this looks like a 1:1- or 1:n-relationship. The only problem i currently have is how to access the values of my TV "group" in all documents with template "doctor".

    Wow, that’s a lot of words, but I hope you have enough time to read it.
    Thank you very much for reading and posting ideas, if any.
    Martin
      • 10313
      • 375 Posts
      Hoohoo!

      I just found the solution by myself. The code for my TVs input values is now:

      @SELECT concat(tv.value, " ", cont.pagetitle) as doctor, tv.id from pre_site_tmplvar_contentvalues as tv, pre_site_content as cont where tv.tmplvarid=10 and tv.contentid=cont.id


      The only issue is the hard coded 10 as template var id. But I think an addditonal join will fix that, too.

      Thanks for the attention wink
      Martin