Changing source dinamically


Hi, everyone. I’m building a react application were we are rendering a couple of visualizations using CF. I have a control (drop down) where the user may select a different source to display different data.

Both sources have the same structure, meaning they have different data but same fields. When the other source is selected it works well for some visualizations but not for others, complaining that some fields are were not found in the source. My question is: Is there a better way to do this? Could I be missing something?


I think you’ll have to provide some more context here. Are you using any front end library such as React or Angular or just plain javascript? Both sources belong to the same provider? Are you using special fields? (derived fields) Changing sources dynamically most of the time should work without issues but it could get a little tricky depending on how are you trying to accomplish it.


With your response I could spot where the problem was: It was a derived filter that was not being added to the second source and it was complaining about it. As soon as I added it to the metadata, it worked. Now I have a different question but is related: In this case the two sources are static. What if one of the sources is not ready at the moment I defined the metadata for the provider. How could I add it later when I receive the source?


Glad I could help. About how to update the provider later, my recommendation is to unregister and then register the provider again after you have updated the custom metadata configuration. Take a look on how to do that here in the docs.