Jump to content

Counters and Resets


js22
 Share

This topic is 5689 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello,

I've run up against a snag. I'm working on a database that monitors experiments done in the lab. We run gels with lanes in them and I'm trying to create a counter that automatically enters the lane numbers.

There are 2 tables in the database (gel info, samples). The first is general information about the gel (date, employee,...) and a gel#. This gel# is what links the two tables. The second table has the gel# and then lane# and sample name.

So when someone enters a new gel record there is a portal on the layout for the "sample" table. I want the lane# field to start with 1 when a new record is created. Then on the next line of the portal, ie sample 2, the lane# increases to 2, next record lane# = 3, etc... as records are added to the samples table through the portal.

I can do that with the serialization but I run into a snag when I create a new gel record. I want the counter to start over at 1 again instead of + 1 from the last lane number assigned.

Do I need a field to perform a calculation and have the lane# access this field.

Any advice would help tons.

Thanks

js22

Link to comment
Share on other sites

You should be able to use a selfjoin on the samples table GelNum field. To create the selfjoin, add a second occurrence of the Samples table on your Relationship Graph (I'll call it HiLane) and drag a relationship between the GelNum fields in each. Then set the LaneNum field to autoenter the following:

Max(HiLane::LaneNum) + 1

I think that should do it...

Link to comment
Share on other sites

Thanks for you help,

I did what you suggested and it seems to work for the first sample. The problem that I'm running into is that it is not recalculating the max(Hi Lane: Lane#).

So if you go to the record it will say what is the highest. So if 2 is the highest as you continue to enter sample names all of the lanes come up as 3.

I've added a template so you can see what I mean. But it is a step in the right direction.

Thanks,

js22

Lane_Numbers.fp7.zip

Link to comment
Share on other sites

This topic is 5689 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.