How to create a Data Store class with a relation

I learned in this tutorial how to create a Data Store Class with a relation

Next, I want to create a screen that performs CRUD of data from a web form

For instance
With the entityselection of Appointment displayed,
Register, modify, and delete relate doctors and patients

Select Doctor to display the relate appointment

Select Patient to display the related appointment

I would like a demo that would be helpful

In particular, I would like to know the mechanism of how to connect relate entities by operation from Web Form

For instance
When adding from an entity to the entity selection of appointment, the mechanism to connect the doctor

How to add and connect appointments from doctor

Where is the key I am connecting

Hello caos,

If I understand correctly, you want to assign a specific doctor to the appointment you are editing.

You can create a Select Box and bind it to the list of all doctors as the DataSource. Then, bind appointment.doctor as the selected element. This will ensure that the selected doctor is assigned to the appointment you are working on.

Here is an example with an Hotel as the Appointment and Destinations as the Doctors :

If I misunderstood, can you please give an example of what you are trying to do?

Thank you for contacting us

This is a common method of booking

Entity selection and entity of Appointment are displayed using the datatable component

Next, add a new Entity of Appointment with a button

Slectbox can only display a maximum of 15 results

So I thought of a different way

Use the DataTable called by the Web Form Loader or the Data Table in Dailog
View the Doctor’s Entity Selection

There you can display an unlimited number of doctors

If i click on the specified doctor line, you will be returned to the data table screen of the appointment.
The name is displayed in the doctor of the Entity of the appointment

Add a patient in the same way as you have done so far

This will register a new appointment

I have one more question

I would like to know how 1-to-N and N-to-1 entities are connected
Which will be the primary key?

Another request would be:
Stored in the doctor’s data class with the doctor’s selection
I also want to display the attributes of the profession and job title in the columns of the data table of appointment

The SelectBox is not limited to 15 items, the Number of items is the number displayed at the same time.
Here Number of items is set to 5 :
image

Here Number of items is set to 2 :
image

But you can scroll the selectbox to see all your selection.
In the examples I have 25 entities in my selection and I can see them all by scrolling

Excuse me

I misunderstood the meaning of the 15 indications
I understood that everything can be displayed by scrolling

But challenges still remain

First of all, on the condition that the doctor name is not decided
I want to make a choice while looking at the doctor’s specialty.

After selecting Doctor, I want to display other attributes of Doctor in the column.

I will try to re-read some of the past materials

I tried again

I want to display the attribute of the Doctor’s data class in the doctor.name of DataTable and the column of Doctor.Speciality
Which data source should I connect from?
What attribute is the dataclass of doctor and appointment connected?

Supplement

This question assumes that you have some data stored in the Doctor dataclass

I don’t quite understand what you are asking for. What is the problem here? You have one doctor linked to your appointment, right? In the datatable, you can display the doctor’s name by setting the doctorname column source to doctor.name. The datatable will act as if it is getting appointment.doctor.name, but I think you have already done that. Could you please provide some screenshots of what is going wrong in the preview and how you expect it to be displayed?

Sorry for the lack of explanation

In the web form of Appointment, when you specify doctor, from the doctor data class
I would like to display other attributes that are relate

Do you understand this?

It’s easy for me to do in 4D

Ok, so if I understand correctly, you want to get the doctor’s specialty, name, and gender from the doctor data class in the appointment web form. In your database model, you already have a direct link between the appointment and the doctor.

To display everything as you wish in a datatable, set the datasource of the datatable to the selection of all your appointments. Then, in your columns, you should have something like this:
image
This will display the specialty in the column you want. You can do the same for the name, gender, etc.

Since your model has direct access to the doctor, you can use it just like you use the date.

Thank you very much
I’ll try again

So I have one question
In the data table of Appointments, what are the conditions for connecting the attributes of one appointment and the attributes of one doctor?

Is it a different mechanism from 4D?

I’m not entirely sure what you mean by:

To use the data table as I showed you, you need to bind the appointment selection to the data table. In the structure of the data class for appointment, you have a doctor entity and a patient entity. If you had an entity selection for doctor, it wouldn’t be possible to display it the way you want.

The only condition I see is that the doctor needs to be an entity then you can display anything from doctor in your appointment data table

Thank you very much

The story changes
Data Explorer is sluggish and does not respond when selecting Doctor Data Classe or Appointment DataClass

Does it have anything to do with it?

I’ll try to recreate everything again
We will also report the results

For instance
In the relation of appointment and doctor
It is about the case when you start operation
If you subsequently disconnect the relation and return it again
Is the connection state of the data preserved?
I would also like to know the details of how it works

It’s a reference story

Illustrate using 4D’s PIQS

I can’t find the key to connect order and order product
If that’s the case, can you reproduce it if you remove the relation attribute and create it again



in the left panel, below “dataClasses”, is there an “attributes” section?
that’s where you select the attributes that will appear.
also make sure the attributes are exposed for REST

Thank you very much

It was linked here

I’m worried about the value when relation is connected again

Also, I would like to know by what rules it is assigned

Also, the relationship is unknown, but there is no response when I select the data class in the data explorer
Is there any cause?