Report: Differentiate content based on the receiver

I have the following set of student records, each of them related to a specific teacher’s email.

image

[Objective]
The objective is that each teacher (column 3) receives the list of students he/she has been assigned from each assistant.

In that way
Assistant 1 would send 2 emails (to teacher 1 and 2)
Assistant 2 would send 2 emails (to teacher 1 and 3)
4 emails total

My initial attempt was the following:

(Assuming that the report runs as each Assistant in the Assistant App)

  • Create an slice based on the user log in
  • Send the report to the teacher’s email registered in column 3
  • This is set based on a daily basis schedule

However, I have read that:

image

If that is true, and the report runs as the App Owner then:

  • Create an slice based on the user log in is gone
  • The App will filter all the records and send the same information to all the teachers

This is not the desired behaviour so I’m thinking about alternatives.

[Alternatives]

  1. I’m not sure if it would be possible to actually configurate the report to send only the related information for each teacher in the report.
  2. If 1 is not possible, I’m thinking that maybe I should create multiple slices, one for each teacher, and create multiple schedule reports to be sent to them.

I’m more inclined for option 2 given my current knowledge on Appsheet but I’m trying to find a more efficient solution, if any.

Thanks for any recommendation!

Luis

1 Like

Thanks Steve!

I’ll put in practice this and the other answer from the other post and see what I get.

Thanks again for your time.

Luis

1 Like

@Steve

I have tried the suggestion but it’s not working as expected but I think the problem is inside my expression.

When I test the script it does the following:

  • It sends the same email to each teacher
  • The attached file has the information of all the teachers

When I played around the option “Create Report” the only difference was the frequency for which I got the emails:

  • Using ForEachRowInTable send the same file to all the emails several times
  • Using ForEntireTable send the same file to all the emails only once.

I do think that I must put a condition inside my Report expression so I only get the Session’s information related to the email I’m sending the information to:

Otherwise the Report wouldn’t have the info to know what to send to each Teacher and just send the whole slice BUT I don’t know if the Expression can interact with / read the current email the Report is looking at.

When you use ForEachRowInTable, you don’t need a <<Start>> tag with a SELECT() expression for the table the report is run from.

I suggest removing this <<Start>> tag and its corresponding <<End>> tag entirely:

<<Start:SELECT(Daily Session[sessionID], TRUE)>>

And replace this tag:

<<SELECT(Trainer[trainerName], ([trainerID] = [_THISROW-1].[trainerID]))>>

with:

<<[trainerID].[trainerName]>>

or (if that doesn’t work)

<<SELECT(Trainer[trainerName], ([trainerID] = [_THISROW].[trainerID]))>>

(Note [_THISROW] rather than [_THISROW-1].)

1 Like