jim shelton Posted October 14, 2010 Posted October 14, 2010 I have a Project Number which is currently set as a serial number. I have a Task Number which needs to increase by one until the Project Number changes. Example: Project Number - Task Number 7100 - 1 7100 - 2 7101 - 1 7101 - 2 7101 - 3 7102 - 1 thanks, Jim
bcooney Posted October 15, 2010 Posted October 15, 2010 Not sure I understand. Do you have two tables, Projects and Tasks (and maybe a join table btw them)? Can you tell us why you need this? Is this a sort order?
jim shelton Posted October 15, 2010 Author Posted October 15, 2010 I have Project Table and Task Table that are related as Project:__KP_ProjectID to Task::__kf_ProjectID. Each project has a unique serial number as project number. I need to show a Task Count number for each project. So when project number changes my thought was to have Task Count number start over at one. Jim
bcooney Posted October 15, 2010 Posted October 15, 2010 Can a Task be associated with more than one project? What is a Task Count number? Is it simply a numbered list of tasks? That can be done with the @@ symbol on a layout.
jim shelton Posted October 15, 2010 Author Posted October 15, 2010 A Task can only be associated with one project. By Task Count I mean Task Number. Another words if the Task Number is 3, then it is the third task under that project. Does that help explain what I am looking for? Jim
didjeridude Posted October 15, 2010 Posted October 15, 2010 I would store the highest project number. When a new project/task pair is being created, for either existing or new project (I assume you already have a way to create a new project and increment the project number), compare the newly created project number to the stored number. If the newly created project number is greater than the stored number; increment the stored number by 1, and set the project's task number to 1. If the newly created project number is less than or equal to the stored number (you may be adding a task to a previous project); just increment that project's task number by one and leave the stored value alone.
bcooney Posted October 15, 2010 Posted October 15, 2010 There are many ways for your technique to fail, least of which is record lock with multi-user access and deletion of projects.
bcooney Posted October 15, 2010 Posted October 15, 2010 (edited) I wouldn't go this route. Let the key field for tasks be a meaningless auto-enter serial number. In the portal of tasks on the project form, simply add a sort order field. This demo from "comment" shows how to elegantly arrange rows in a portal. http://fmforums.com/forum/showpost.php?post/294075/ Edited October 15, 2010 by Guest
jim shelton Posted October 15, 2010 Author Posted October 15, 2010 That is very clean, thanks for sharing. Jim
Recommended Posts
This topic is 5211 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