A controller containing properties and methods about the models (meta data).
It is recommended for better support of types by code assistance in IDEs to usegetFrappeMetaController()
in order to get the instance of FrappeMetaController
instead of renovation.meta
which is MetaController
if the backend is Frappè, for instance. In this guide we will use Frappé as an example and use getFrappeMetaController().
To get the number of documents based on a filter.
property | type | required | description |
doctype | String | yes | The target doctype |
filters |
| no | Filters based on |
RequestResponse<int>
RequestResponse<int> docCount = await getFrappeMetaController().getDocCount(doctype: "Chat Profile",filters: [["name", "LIKE", "[email protected]"]],);if (docCount.isSuccess) {print("Number of docs : ${docCount.data}");} else {print(docCount.error);}
HTTP code:
404
type:
NotFoundError
cause: DocType does not exist
suggestion: Make sure the queried DocType is input correctly or create the required DocType
type:
InvalidFrappeFilter
cause: The supplied filter doesn't comply with DBFilter
suggestion: Make sure the filter comply with DBFilter class
To get a doctype's meta. Meta of a doctype is the details about a doctype including but not limited to, DocFields, permissions, etc..
This is useful especially for building the UI based on the fields and properties of a DocType.
property | type | required | description |
doctype | String | yes | The target doctype |
RequestResponse<DocType>
RequestResponse<DocType> docMeta =await getFrappeMetaController().getDocMeta(doctype: "User");if (docMeta.isSuccess) {print("Doc meta : ${docMeta.data}");} else {print(docMeta.error);}
HTTP code:
404
type:
NotFoundError
cause: DocType does not exist
suggestion: Make sure the queried DocType is input correctly or create the required DocType
To get the document's information defined by DocInfo
of a certain document of a certain doctypes.
property | type | required | description |
doctype | String | yes | The target doctype |
docname | String | yes | The target document |
RequestResponse<FrappeDocInfo>
RequestResponse<FrappeDocInfo> docInfo = await getFrappeMetaController().getDocInfo(doctype: "User", docname: "[email protected]");if (docInfo.isSuccess) {print("Doc info : ${docInfo.data}");} else {print(docInfo.error);}
HTTP code:
404
type:
NotFoundError
cause: DocType does not exist
suggestion: Make sure the queried DocType is input correctly or create the required DocType
HTTP code:
404
type:
NotFoundError
cause: Docname does not exist
suggestion: Make sure the queried document name is correct or create the required document
HTTP code:
404
type:
NotFoundError
cause: DocInfo not found
suggestion: Make sure the document has DocInfo
To get the label to be used on a field
property | type | required | description |
doctype | String | yes | The target doctype |
fieldname | String | yes | The target within the doctype |
String
String fieldLabel = await getFrappeMetaController().getFieldLabel(doctype: "Renovation Review", fieldName: "reviewed_by");print("Field label: $fieldLabel");
HTTP code:
404
type:
NotFoundError
cause: DocType does not exist
suggestion: Make sure the queried DocType is input correctly or create the required DocType
To get the report meta of Renovation Report
doctype.
property | type | required | description |
report | String | yes | The name of the |
RequestResponse<RenovationReport>
RequestResponse<RenovationReport> reportMeta =await getFrappeMetaController().getReportMeta(report: "TEST");if (reportMeta.isSuccess) {print("Repot meta: ${reportMeta.data}");} else {print(reportMeta.error);}
HTTP code:
404
type:
NotFoundError
cause: The target report does not exist
suggestion: Make sure the name is correct or create the report