Hi all, I’m fairly new to JA. I have a broad question regarding best practices on representing choice lists integrated from an external repository.
We have around 200 lists of items about half of which should be multi-select. In the future we may have to change a list from single to multi-select or vice versa which adds some additional complexity here. Each list consists of anywhere from 2 to 15 options that each consist of a string display name and an integer ID. The lists all live in a repository accessible via REST API. The names of items may periodically change, but the IDs never will.
The way I see it we have two broad approaches (I don’t think 3 makes sense), but I’m open to other suggestions:
- Represent each Value List as a model. We can then populate the model via API and update display names as needed.
i. Easier and cleaner to integrate. Can use built-in endpoints for instantiating value list item vs the file API to update the model which is messy and requires redeployment
1. Note that value list contents change fairly rarely, but it does happen
ii. Reusable across models. We will end up implementing multiple types of Surveys and there are some value lists that overlap
i. Data model bloat. We have to implement hundreds of models and map each of them to the value list in the ECM
1. This is fairly minor as I understand it. The number of models isn’t hugely important, right?
ii. The view code gets uglier in the case of multi-select lists. Instead of a simple one-liner multi-select component, we have to implement some JS that instantiates a join table model object.
1. We can perhaps consolidate this into some common function(s) reused across views?
- Add a choice list for each value list. Populate the contents either manually or via file API (where is the documentation on the file API?). Pros and cons are largely the reverse of the above
i. Data model and views are by and large cleaner
i. More challenging to integrate. Using the file API sounds messy
ii. Not reusable across models. When value list items change, they would need to be updated within every model that uses it
- A single model for capturing JSON serialized value list items as objects and then deserialize this into choice options at runtime? The actual survey field would then be text and selecting from one of these.