get_state_fields = async (
  table_id,
  viewname,
  { list_view, show_view }
) => {
  const id = {
    name: "id",
    type: "Integer",
    required: false,
  };
  if (list_view) {
    const lview = await View.findOne({ name: list_view });
    if (lview) {
      const lview_sfs = await lview.get_state_fields();
      return [id, ...lview_sfs];
    } else return [id];
  } else return [id];
}
@param {*} table_id
@param {*} viewname
@param {object} opts
@param {string} opts.list_view
@param {*} opts.show_view
@returns {Promise<object[]>}