• How would you set up template/project so that student could see his classmates in (each) course? How would the Where Clause be written? Thank You.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi @lrydant,

    You can probably solve this in several ways. I think I would create a project page for the course table and use the $$USERID$$ in the default where to show only courses for the logged in student. Then create a 1:n many relationship from courses to student and show all students except the logged in user (add != $$USERID$$ to the default where clause of the child table).

    Please be aware that you need to put the default where for the child table in your project template. The default where for the parent table goes into the project page.

    Does this help?
    Peter

    Thread Starter lrydant

    (@lrydant)

    I can not get this to work. I tried on the SAS demo and also on my tables which little simpler. I have group and member tables – each member belongs to only 1 group. I did as you suggested – created project page based on group with default where member_username = $$USER$$ and template with relationship of 1:n group and member with default where member_username != $$USER$$. Got no data with the default where in the project and the default where in the template didn’t seem to any effect on the data.

    Only solution I can think of is to store member GroupID in the wp_users table but I guess that is a no-no.

    Appreciate your thoughts. Thank you.

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi @lrydant,

    >>> Only solution I can think of is to store member GroupID in the wp_users table but I guess that is a no-no.

    Correct! Don’t modify WordPress tables… ??

    Try to work on the parent table first. Add your default where to your project page and check if if works:
    member_username = $$USER$$

    Does this work?

    Thanks,
    Peter

    Thread Starter lrydant

    (@lrydant)

    This worked for the default where. Thank you!

    (((group.groupid) In (SELECT groupid FROM member WHERE member_username =$$USER$$)))

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Great! ??

    Now you have to add the default where for the child table in the project template:
    https://wpdataaccess.com/docs/documentation/project-templates/table-settings/

    Make sure you enter != $$USER$$

    Does it work?

    Thanks,
    Peter

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WPDA_SAS Demo – show student his classmates in each course’ is closed to new replies.