Filter Grid Issues

I have a Courses Table and a Students table. Courses has a single-value Language field. Students has a multi-value Language field. I want my grid of Course listings to show only Courses where the Course Language matches one of the Student Languages. I don’t see any way to do this. I can do it with Javascript (which is client side) by adding a grid of Students that includes the Languages field. But I only want this grid to show the logged in Student. I don’t see how to do that, either. These seem like pretty simple and useful things to do. I hope others have seen similar things and found solutions. Thank you.

Hi @Stephen4,

Welcome to the Knack community! :tada:

Thanks for sharing what you’re trying to accomplish here! While I don’t have a solution to provide you at this time, I have a few questions about your setup that may help others guide you in the right direction:

  1. The “Language” field that you have in each data table (Students & Courses), is it a multiple-choice field?
  2. How are the Students and Courses data tables connected? Do you have a one-to-many connection field or many-to-many and what data table does the connection field exist in?
  3. To confirm, is your Students data table a user role table?

Any additional details you can share about your app and setup may help get you answers.

Additionally, if you don’t find a solution here in the forum, you’re always welcome to reach out to our support team for assistance. To reach them, you can submit this form here: Create Support Ticket

Happy building :slight_smile:

Thanks for the welcome and for taking an interest. I have a Language table which populates the options of a multi-select field in the Student Table and a single-select field in the Course table. Thus, there is a many-to-one connection to the Languages table in the Courses table and a many-to-many connection to the Languages table in the Student table. The Student data table is a user role table. I have a conversation going with support on this, but it has not provided an answer yet. One thing I have figured out is how to get a view that shows only the current logged in student - by using a Detail type view rather than a Grid type view. I am having some difficulty accessing that in Javascript for some reason, but I can probably figure that out. I just think it should be possible without Javascript.

1 Like

Update - I have now got this working with AI-assisted JavaScript. “We” solved the problem of accessing the Detail student view and got the logic right, verifying it works when the Student has multiple languages. I still think it should work without Javascript, but I haven’t succeeded in figuring that out. I need Javascript filtering anyway because I want to filter out already enrolled courses for the current student when I list available courses for the current student. Knack does have a limitation that it can’t filter based on my “junction table” that tracks enrollments many-to-many. And I have to implement other custom filters that will rely on junction tables. So maybe I will stick with this. If anyone is interested, I’ll be happy to share the code.

1 Like

With the help of support, I now see it’s quite easy to do this when you specify the source of a view. I just missed the dropdown option that provides it. However, I don’t see a way to change that setting once the view has been created.

@Stephen4 I’m glad you got the assistance you needed from the support team! :slight_smile: The view’s source (the data table the view utilizes to display records) can not be changed once the view has been created:

Unfortunately, if you want to change the data table source, you must create a new view from scratch.

To learn more about Source settings, check out our article here: Source: Which Records Will the View Display

(I realised after responding that he already had the info he needed, and cant work out how to delete this)