EnumList from another table

Hi all,

I have two tables, โ€œAppointment detailsโ€ and โ€œHair Servicesโ€.

Hair Services has the following column:
[Service]
[Estimated Time]

I want to create an EnumList in the โ€œAppointment detailsโ€ table which adds multiple services from the โ€œHair Servicesโ€ table. Also, I want to calculate the total time for each service and store it in a virtual column in the โ€œAppointment detailsโ€ table.
The appointment table should have the following.
Service list: (Enum list form Hair Service table)
Total time: (VC sums the estimated time for each service added)

Is there an app formula that I can use?
I see that part of this question has already been answered previously using SELECT and IN, but for some reason, I get an error (Parameter 2 in IN is wrong).

Any help is really appreciated. Thanks in advance.

Thanks,
Ankit

Solved Solved
1 6 5,871
1 ACCEPTED SOLUTION

For that u have to create a child table using isapartof in the table โ€ฆ

First create a new table with columns like unique id, order id(this will be the key of main table), Service REQD, time taken,

Order id should be made ref and isapartof should be turned on

Then in the main table add a new column naming it total time reqd and put formula

Sum(select(childtablename[time taken],[order id]=[_thisrow].[keyofmaintablecolumheader]))

This will do the job

View solution in original post

6 REPLIES 6

in Service List Table make data type enumlistโ€ฆ

and in the data validity of this column header put the below expression

Hair Services[Service]

where Hair Services refers to the table and Service refers to the column in the table Hair Services

It should work without any issue

Thank you for your response. The issue is, I need to reference the Service list column to Hair Services[Service] column because I also want to calculate the estimated time of each service that is added, based on the column Hair Services[Estimated time].

in that case u have to first create a child table to add service listโ€ฆin the child table u can add any no. of services the customer wants to use and in the parent table you use an expression to calculate the total time reqd for this customer.

Thank you for your response. I have created the โ€œService listโ€ as a ref to โ€œServiceโ€ in the โ€œHair Servicesโ€ table and have modified the virtual column in the โ€œHair Servicesโ€ table with the following app formula.

SELECT(Appointment details[Uniqueid], IN([_THISROW].[Service],{โ€œService listโ€}))

I assumed that this will generate an enum list type reference for the Service list column but it just creates a one to one reference. How can I add multiple Services to one appointment?

Hope my question is clear.

Thanks in advance

For that u have to create a child table using isapartof in the table โ€ฆ

First create a new table with columns like unique id, order id(this will be the key of main table), Service REQD, time taken,

Order id should be made ref and isapartof should be turned on

Then in the main table add a new column naming it total time reqd and put formula

Sum(select(childtablename[time taken],[order id]=[_thisrow].[keyofmaintablecolumheader]))

This will do the job

That worked. Thanks a lot.

Ankit

Top Labels in this Space