[solved] Data Context - strange behavior with reactive-table

Soo new day new problem (: I did this all day long and slowly I became crazy … so the problem is as follows:

I use reactive table with a field called :

 {
        key: 'status',
         label: 'Status',
         tmpl: Template.Status
                    },

so that I can use my Template Status:

<template name="Status">
    <div class="circle"><i class="fa fa-coffee"></i></div>
    <div class="circle"><i class="fa fa-sun-o"></i></div>
    <div class="circle"><i class="fa fa-moon-o"></i></div>
    <div class="circle"><i class="fa fa-star"></i></div>
</template>

I wrote a helper

Template.Status.helpers({
   medicationPlanStatus : function () {
       return MedicationPlan.find({})
   }
}); 

to get my collection ( and it finds it)

but when I try to adress the fields like {{activeSubstance}} e.g.

 <template name="Status">
        <div class="circle"><i class="fa fa-coffee"></i></div>
        <div class="circle"><i class="fa fa-sun-o"></i></div>
        <div class="circle"><i class="fa fa-moon-o"></i></div>
        <div class="circle"><i class="fa fa-star"></i></div>
       {{activeSubstance}}
    </template>

I get nothing but with a {{#each}} I set the data context but for every activesubstance, this is somehow what I want… {{#with}} wont work to just gimme 1 activeSubstance and not all for every patient. Any ideas?

{{firstName}} and everything works fine but because it is the default-collection I have included like:

<template name="patients">
  {{> reactiveTable collection=patientList settings=tableSettings}}
  {{> editPatientModal}}
  {{> deletePatientModal}}
    {{firstName}}
</template>

with the helper:

Template.patients.helpers({
    patientList: function () {
        return Patients.find({})
    }
});

I tried this solution:

 Template.patients.helpers({
        patientList: function () {
            return Patients.find({}) && MedicationPlan.find({})
        }
    });

but this is a mess… But otherwise I have access like {{activeSubstance}}

Any ideas so far? If you need more information let me know (: thanks for reading :blush:

So, I merged my 2 collections into one to get the data but now I have another problem… >.>

For every activeSubstance I create for a specific patient I get this:

I think it has something to do with the filtering, but I do need every patient - for what should I filter to display the icons next to the specific patient? I filter the patients and there specific medications so I can get this:

the code for doing this goes like:

Template.medicationPlan.helpers({
  patientMedicationPlan: function() {
    return Patients.find({
      'patientId': this._id
    });

for Patients it goes like:

Template.patients.helpers({
    patientList: function () {
        return Patients.find({})
    }

If I do filtering like with medications I get:

not exactly what I want…

Any ideas? :sunny:

thanks in advance (:slight_smile:

problem solved with a inception-strategy:

I put another reactive-table inside my main reactive-table put this time with a pointer to a helper returning the medicationPlan-collection

Thanks me (: