Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titleExample Template Using Attributes and Principal
SELECT
 id,
 #if (${eduPersonAffiliation.values.contains("student")}
 courseid
#end
FROM PEOPLE
#if (${eduPersonAffiliation.values.contains("student")}
LEFT JOIN COURSES ON people.id=courses.personid
#end
WHERE uid='${principal.get(0)}'
Note

Variables passed in through dependencies used in your query may actually be collections and need special handling. As an example, if you use a static data connector to define a fixed value to be passed into your SQL, it is actually a collection of values. What this means is that a given a static data connector foo that defines a value students used in a query like this:

Code Block

     SELECT * FROM PEOPLE WHERE userid = '$requestContext.principalName' and group = '$foo'

will result in a select statement to your database of:

Code Block

     SELECT * FROM PEOPLE WHERE userid = 'george' and group = '[students]'

to get what you would expect, define the query as:

Code Block

     SELECT * FROM PEOPLE WHERE userid = '$requestContext.principalName' and group = '$foo.get(0)'

and will result in a select statement to your database of:

Code Block

     SELECT * FROM PEOPLE WHERE userid = 'george' and group = 'students'