system-designer
system-designer copied to clipboard
Where can I see the description of types and schema key:value?
Hi @ecarriou,
I learn how to use System Designer to design the database and relationship between forms. And I got confused by the various options for types and schema key:value. Where can I get a description of each options? From there I hope to be able to understand more about how to use System Designer. Or if there are more example of how the things work.
Example of things I want to do:
- in the forms there will be dropdown list of related items. How to create this dynamic list?
- also a dropdown but for a fixed selection like gender, how to make this?
- for a selection of location, I want user to select a city, then the system will auto-fill the state. How to relate state with city?
- etc.
Thank you
- System Designer version number: v5.2.0
- System Designer platform: macOS
- Your OS version: macOS 12.3.1
Hello,
Did you check first the documentation for creating schemas, models and types ?
If you want a description of the properties you can have a look in the MSON core definition files of System Runtime. For example, here is the description of a type schema:
{
"_id": {
"type": "string",
"mandatory": true
},
"name": {
"type": "string",
"mandatory": true
},
"type": {
"type": "string",
"mandatory": true
},
"schema": {
"type": "object",
"mandatory": false
},
"value": {
"type": ["any"],
"mandatory": false
},
"core": {
"type": "boolean",
"mandatory": false
},
"description": {
"type": "string",
"mandatory": false
}
}
For information there are also many checks done on save to help you to write valid schemas.
About your questions, there is not only one way to do what you want but here some tips.
If you have for example this definition for this new type:
{
"_id": "d82472ce-3034-4bd2-ad55-ad25eb04c09c",
"name": "eyeColor",
"description": "eye colors",
"type": "string",
"value": ["blue", "green", "maroon", "other"]
}
and this model:
{
"_id": "bdce6d04-d68f-4c2a-b36a-565ff06d3cb9",
"_name": "Person",
"_description": "",
"eyeColor": {
"description": "",
"type": "eyeColor",
"readOnly": false,
"mandatory": false,
"default": "maroon"
}
}
To get the list of values to fill a dropdown where you can select an eye color:
// in a behavior you can require the Datastore to get the type definition
const db = this.require('db')
const eyeColorDefinition = db.collections()._Type.find({name: 'eyeColor'})[0]
const values = eyeColorDefinition.value
When a value is selected in the dropdown you can update the component:
this.require('id_of_the_component').eyeColor('blue')
Also remember that you can export your system and use it in any JS Framework. For example you can define your UI with React, import your system and then use create/edit/delete components.
Is that answer to your questions ?
Hello,
Thank you for your long and quick response. π
I will try your suggestions and see if I can find my way using your guidance.
If there is any more issues I will come back to you.
Cheers,
βββββ This electronic message contains information which maybe privileged or confidential. The information is for the use of the intended individuals or entities only. Any unauthorized disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this electronic message in error, please notify the sender by telephone or email immediately and destroy all copies of the message. βββββ
On 27 May 2022, at 20.57, Erwan Carriou @.***> wrote:
ο»Ώ Hello,
Did you check first the documentation for creating schemas, models and types ?
If you want a description of the properties you can have a look in the MSON core definition files of System Runtime. For example, here is the description of a type schema:
{ "_id": { "type": "string", "mandatory": true }, "name": { "type": "string", "mandatory": true }, "type": { "type": "string", "mandatory": true }, "schema": { "type": "object", "mandatory": false }, "value": { "type": ["any"], "mandatory": false }, "core": { "type": "boolean", "mandatory": false }, "description": { "type": "string", "mandatory": false } } For information there are also many checks done on save to help you to write valid schemas.
About your questions, there is not only one way to do what you want but here some tips:
if you have for example this definition for this new type: { "_id": "d82472ce-3034-4bd2-ad55-ad25eb04c09c", "name": "eyeColor", "description": "eye Color", "type": "string", "value": ["blue", "green", "maroon", "other"] } and this model for a component:
{ "_id": "bdce6d04-d68f-4c2a-b36a-565ff06d3cb9", "_name": "Person", "_description": "", "eyeColor": { "description": "", "type": "eyeColor", "readOnly": false, "mandatory": false, "default": "maroon" } } To get the list of values to fill a dropdown where you can select an eye color:
// in a behavior you can require the Datastore to get the type definition const db = this.require('db') const eyeColor = db.collections()._Type.find({name: 'eyeColor'})[0] const values = eyeColor.value You can set a type to a component:
this.require('id_of_the_component').eyeColor('blue') Also remember that you can export your system and use it in any JS Framework. For example you can define your UI with React, import your system and then use create/edit/delete components.
Is that answer to your questions ?
β Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.
You are welcome.
Do not hesitate, if something is not clear I will update the documentation.
Where can I find the PWA version?
You have just to click on Try it online
button on https://designfirst.io/systemdesigner/ .
Direct links:
- For desktop browsers: https://designfirst.io/designer/
- For mobile browsers: https://designfirst.io/design/