add dynamic number of models, tables, and/or includes?

Brainstorm needed!

I have a situation where I’m trying to add a set pool of students to a handful of classes. Each student from the pool can be added to any of the classes.

The big challenge is that depending on some variables, the number of classes is unknown, and can range anywhere from 2-10.

Luckily, the classes don’t really need to have their own functionality, just display a list of the students added and refresh when a new student is added.

Any ideas on the best way to handle this? My current idea is to build a single class page, then include it 10 times in an assignment page, setting the query string dynamically via javascript for each one. This limits my need to maintain 10 identical tables, but also seems clunky.

Other ideas I’ve had:
- Dynamically build each model. The problem here is that I also need to dynamically build each table, or hack the xml to create references that don’t yet exist, which is a bit of a pain.

- Create one table, sort by class, and try to use CSS or some Skuid functionality I don’t know to break it up into multiple tables.

Anyone got any ideas?


Hi Seth, can you elaborate a little on your data map? It sounds like you might be using a junction object to connect students and classes. If the classes don’t need their own identity, are they being, or could they be stored as multiselect picklist options on the Student object?


Setting the class is not the hard part, it’s displaying a table for each class. You’re right that there is a Course Assignment junction object. I basically need to display X number of tables, one for each class.

I’m currently working on building a custom table view that uses divs and closes them whenever a new course appears in the table (I’m sorting the Course Assignments based on course). I’m hopeful it’ll work.

Open to better ideas, though. :slight_smile:


If I understand you correctly, then I think you’d want:

  • A "Classes" Model, and a Deck component to go with it.
  • A "StudentAssignment" Model, and a Table component within the Deck to go with it.
Use the Table's "Context" tab to set conditions on the table to only show the assignments associated with the "current" class (one class per card within the deck).

The assignment record would, presumably, include a reference to the student, and you could display that reference field in the table.

The end result would be a dynamic number of tables (one table for each class) showing you all the students assigned to each class. You could add a Page Title above each table to display the class name.

Below is an example using standard Salesforce objects.

You could take it a step further. Reference fields allow you to specify custom filters. You could add a “StudentPool” Model and then force the reference field on the “StudentAssignment” Model to select one of students in that model via a “in” condition.

  1. Click on the Student reference field in the table (we'll call it "StudentId")
  2. Choose the "Filters" tab
  3. Add a new Lookup Filter
  4. Choose "Field from another model" for the "Content"; "in" for the "Operator"; "StudentId" for the "Field"; "StudentPool" for the "Source Model"; and "Id" for the "Source Field".
The user will be able to use each class table to assign students by creating a new "StudentAssignment" record and selecting one of the students from the pool.
<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true">    <models>
        <model id="Accounts" limit="20" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Account">
                <field id="Id"/>
                <field id="Name"/>
        <model id="Opportunities" limit="20" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Opportunity">
                <field id="AccountId"/>
                <field id="Account&#46;Name"/>
                <field id="Name"/>
                <field id="Description"/>
        <deck searchmethod="server" searchbox="true" columngutter="&#46;75em" rowgutter="&#46;75em" model="Accounts" filtersposition="top" filterswidth="150px" showsavecancel="false" behavior="flex" verticalalign="top" ratio="1" minwidth="350px" uniqueid="sk-22ofpw-134" buttonposition="" pagesize="10">
                <pagetitle model="Accounts" uniqueid="sk-22oozP-164">
                <skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="Opportunities" buttonposition="" mode="read" allowcolumnreordering="true" uniqueid="sk-22oiLD-146">
                        <field id="Name" hideable="true" uniqueid="fi-22or-8-169" valuehalign="" type=""/>
                        <field id="Description" hideable="true" uniqueid="fi-22osoc-179" valuehalign="" type=""/>
                        <action type="edit"/>
                        <action type="delete"/>
                    <massactions usefirstitemasdefault="true">
                        <action type="massupdate"/>
                        <action type="massdelete"/>
                        <view type="standard"/>
                        <condition type="contextrow" field="AccountId" mergefield="Id" operator="="/>
        <styleitem type="background" bgtype="none"/>

JD - I’d never used a Deck component before and didn’t know it existed. It’s exactly what I need and I’ve got it working already. Thank you! Way better than a custom view.