getformListSubTitleField function

String getformListSubTitleField(
  1. SqfEntityTableBase table
)

Implementation

String getformListSubTitleField(SqfEntityTableBase table) {
  String fieldName = '';
  table.formListTitleField = getformListTitleField(table);
  if (table.formListSubTitleField != null) {
    fieldName = table.formListSubTitleField!;
  } else {
    for (final field in table.fields!) {
      if (field is! SqfEntityFieldVirtualBase) {
        if (field.dbType == DbType.text &&
            field.fieldName != table.formListTitleField) {
          fieldName = field.fieldName!;
          break;
        }
      }
    }
    if (fieldName.isEmpty) {
      for (final field in table.fields!.where((f) =>
          f is! SqfEntityFieldVirtualBase &&
          !(f is SqfEntityFieldRelationshipBase &&
              f.relationType == RelationType.MANY_TO_MANY))) {
        if (field.fieldName != table.formListTitleField) {
          fieldName = field.fieldName!;
          break;
        }
      }
    }
  }
  return fieldName;
}