Can I add columns to a relationship tab dynamically?

How do I add a column to a relationship tab dynamically.

I wish to federate an ItemType, the number of columns returned depends on the dataset and query combination and cannot be predicted prior to the query being run. Typically I would expect 30-40 columns, but could theoretically be up to 200.

My plan is to add a relationship type which is populated onGet, to bring back the required information using my Query.  I would not to create a custom relationship view, as this will ensure compatibility with future upgrades. 

What is the best way to proceed?

  • Can I create columns dynamically to return the results?
  • Do I create a related ItemType with 200 columns and hide the ones I'm not using with JavaScript?

Any help is appreciated.

Many thanks,