mleiser Posted March 1, 2012 Posted March 1, 2012 I have two tables, Parents and Children. My input screen for each parent contains a portal for entering children information. For each child added I now enter a child number manually. Is there a way to enter the child number automatically. That means for the first child entered, the child number is number 1. For the second entered, it's number 2, etc. Then if we delete one child, the numbers have to reevaluate itself. The reason we need this is for charges. Each child in a family is charged less than the previous one. But if one leaves, we have to recalculate the numbers for the remaining children. Currently, entering the child number is done manually. All the calculations based on the child number is done automatically. Thanks. Mike
comment Posted March 1, 2012 Posted March 1, 2012 Can you explain what the "calculations based on the child number" are? Wouldn't it be simpler to calculate the total charge at the parent level, using the count of children as the input?
Ocean West Posted March 1, 2012 Posted March 1, 2012 in the child table use auto enter calculation with this function Get ( ActivePortalRowNumber ) - if your in FMP 11 earlier versions use Get (PortalRowNumber) the only way to re-evaluate all the items in the list is to run some sort of update script on the children record by either looping thru the portal setting each row - or going to the related children records looping thru them or replacing the Number + 1. alternatively if you don't need to store the number - or use it in a calculation - you can just use @@ in the portal and it will always display the number of the row.
mleiser Posted March 1, 2012 Author Posted March 1, 2012 Basically it's for charges in our day camp. For example, if the first child charge is $1,000, the second might be $50 less, or 950, the next child would be 900, etc. There may be other charges for the individual children, for example, one of the children may use bus service, that has an extra charge. So for each child in the portal we keep track of all their charges. In the family record we of course add them all up for a total family charge. Sometimes they may add a child or remove a child, so the number of the individual child may change. Thanks. Mike
comment Posted March 1, 2012 Posted March 1, 2012 The reason I suggested calculating the overall charge at the parent level is that it's not as straightforward for a child to calculate its ordinal number among the siblings as it is for a parent to count its children. If you still want to go that way, try defining a calculation field cListChildIDs (result is Text) in the Families table = List ( Children::ChildID ) Then calculate the child's ordinal number as = ValueCount ( Left ( Families::cListChildIDs ; Position ( ¶ & Families::cListChildIDs & ¶ ; ¶ & ChildID & ¶ ; 1 ; 1 ) ) ) Note that the ordinal number is calculated according to the sort order of the relationship. 1
Recommended Posts
This topic is 4710 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now