Use Enumlist results to calculate a price for each value of the EnumList selected by user

Hi, I'm trying to set up a simple App to manage a car used by students. 
I managed to have the app calculate e cost of trip (by time and km). Now I have an EnumList  columns (that takes the names from a Worksheet) with the Names of the User of the car for each trip
The driver encharged select the names of users fo a specific trip in this EnumList column in the App.
So the result is "name1 , name 2 , name 3" ... (btw I would like to limit choises to 5, but couldn't find how).

Since users might have done half of the trip I would like user to apply a percentage (maybe just by half) so that I can share the total cost of the trip to the different user.

Solved Solved
0 11 185
1 ACCEPTED SOLUTION

It looks like you're using a comma in the dereference expression, should be a period.

Your virtual column is type List, change it to yes/no to match the expression result.

View solution in original post

11 REPLIES 11

Instead of an EnumList, you should set up a child table to hold the passenger info. Each child record has a single name, and their percentage.

Thanks a lot Marc,
You mean something like this? 
                   % trip 1   %trip2
name1   
name2
name3 
The EnumList had the advantafe that in just one place I had the button for each passenger to be chosen by the User

 

andreagiordano_1-1674840055576.png

My idea was: the user choses between names, otherwise I should put 5 columns one for each possible passenger ... but hten I don't know how i can connect it with the child table. But maybe this is the most straight forwardsolution


@andreagiordano wrote:

You mean something like this? 
                   % trip 1   %trip2
name1   
name2
name3 


I don't know what that's supposed to be representing.

https://help.appsheet.com/en/articles/961426-references-between-tables

 


@andreagiordano wrote:

The EnumList had the advantafe that in just one place I had the button for each passenger to be chosen by the User

My idea was: the user choses between names, otherwise I should put 5 columns one for each possible passenger


Sure, you can do that if you really want. But then you have terribly formatted data that is very difficult to scale up, and difficult to work with for anything down the road.

 

Thanks for the reply Marc .. I have to work on it a little bit more  ... stll I don't see hoew could I use your solution. I'll read the link you sent and I'll try something ... thanks a lot!

Hi, I tried to read here and there 4 hrs now but I'm still stuck here.
I try to summarize since my previous messsage think where poorly understandable ...

I'm tring to set up this app that manages trips for a group of students that share a car.
I have the app collect some information and calculate others like date time of trip's registration (kye), date of trip, destination, start time, end time, driver, destination km, total cost of the trip.   

andreagiordano_0-1674925158912.png

Now the problem is how to share the total cost between passengers that can variate in number and name ... One possibility is to add some columns in the main table for each passenger with its percentage of share (imput by users). Still have to see how calculate the cost for each one and how to show share. But also I see it has some flexibility problem: students could be more than just 5 bacause they coudl come on board just for a a bit of the trip so they could be 5, 6,7 10?. 

andreagiordano_1-1674926366130.png

You suggested me a child table I created something like this referenced to the main table through registrazione field. I understand that main table has one row for each trip, Child table should have one row for each passenger. 

andreagiordano_2-1674926800859.png

If the above sould be the result I don't understand how  to guide user to fill it up. Beacuse I have one view that populate the main table and don't understand how to populate second table. Can I let the user populate two tables from one View ? Can I show the user fieald of passengers and percentage of use so that I can populate  child table? Couldn't find an answer for this There are many other open questions ... but one step at a time!   I felt I was very near but now this problem ... tink is too much for me.  🙁

From the trip record, the user can add new passenger records, one at a time. There should be an inline view with an "Add" button.

Did it, it took me quite a lot,  I managed to get the add button for the inline view but at a certain point I lost it .... silly of me I unshowed reference column .-(

Now I'm tryig to dereference the cost column to make calculation (multiply the total cost for the percentage of each passenger) on it and the reply is:  "The expression is valid but its result type 'Ref' is not one of the expected types: Price" 
[Viaggio],[costo] ... -> where viaggio is the ref column in the child table anda costo is the column value i'm interested in ... cannot see why. This formula is in the column Costo personale that is formatted as "price"
Then I'm wondering how I can check data entry: how can I check that the sum of percentage of the different passengers of a trip is 100%  

What is the column type of the [costo] column in the parent table?

how I can check data entry: how can I check that the sum of percentage of the different passengers of a trip is 100%  


In the parent table, a virtual column of:

SUM( [Related...][Percentage] ) = 1

https://help.appsheet.com/en/articles/4575708-list-dereference


@Marc_Dillon wrote:

What is the column type of the [costo] column in the parent table?


 [Costo] is Price type .. . 

when I manage to "test" this formula [Viaggio],[Costo] that is in the Column [Costo personale] -Price Type- in the Child Table  the result is the content of [Registrazione] where:

  • [Viaggio]: Child Table - ref type- ... should be my doorway in child table to acces parent table as I understand
  • [Costo] Parent table column from which I want the value - Price type-
  • [Registrazione] Parent table -ref Type- my doorway in parent table

andreagiordano_0-1675348483995.pngFrom Child table

The same problem happens when I do as you suggested (at least I think I do).

Created a virtual column in parent table, type List, that point to [percentuale] -percent type-  but here below is the error I get... where did I stuble?

andreagiordano_2-1675349078709.png

 

andreagiordano_1-1675348873594.pngFrom Parent Table

 

It looks like you're using a comma in the dereference expression, should be a period.

Your virtual column is type List, change it to yes/no to match the expression result.

OMG!!!😮 it looks like I produced my fist app!!! Thanks a lot Marc! Now I will have to Beta test it and then refine it ... little by little

Top Labels in this Space