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?
Thanks,
Seth
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?
Mark,
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.
Seth
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.
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.
- Click on the Student reference field in the table (we'll call it "StudentId")
- Choose the "Filters" tab
- Add a new Lookup Filter
- 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".
<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">
<fields>
<field id="Id"/>
<field id="Name"/>
</fields>
<conditions/>
<actions/>
</model>
<model id="Opportunities" limit="20" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Opportunity">
<fields>
<field id="AccountId"/>
<field id="Account.Name"/>
<field id="Name"/>
<field id="Description"/>
</fields>
<conditions/>
<actions/>
</model>
</models>
<components>
<deck searchmethod="server" searchbox="true" columngutter=".75em" rowgutter=".75em" model="Accounts" filtersposition="top" filterswidth="150px" showsavecancel="false" behavior="flex" verticalalign="top" ratio="1" minwidth="350px" uniqueid="sk-22ofpw-134" buttonposition="" pagesize="10">
<components>
<pagetitle model="Accounts" uniqueid="sk-22oozP-164">
<maintitle>
<template>{{Name}}</template>
</maintitle>
<actions/>
</pagetitle>
<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">
<fields>
<field id="Name" hideable="true" uniqueid="fi-22or-8-169" valuehalign="" type=""/>
<field id="Description" hideable="true" uniqueid="fi-22osoc-179" valuehalign="" type=""/>
</fields>
<rowactions>
<action type="edit"/>
<action type="delete"/>
</rowactions>
<massactions usefirstitemasdefault="true">
<action type="massupdate"/>
<action type="massdelete"/>
</massactions>
<views>
<view type="standard"/>
</views>
<conditions>
<condition type="contextrow" field="AccountId" mergefield="Id" operator="="/>
</conditions>
</skootable>
</components>
<massactions/>
<interactions/>
<actions/>
</deck>
</components>
<resources>
<labels/>
<javascript/>
<css/>
</resources>
<styles>
<styleitem type="background" bgtype="none"/>
</styles>
</skuidpage>
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.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.