AnsweredAssumed Answered

Serial number reset script based on previous fields

Question asked by breeanne on Nov 21, 2016
Latest reply on Nov 21, 2016 by breeanne

Hi, I have one table that I'm trying to create a usable ID (and Get(UUID) would be cumbersome to reenter in another table) to link points.

 

Table 1:

Table 1 ID

Lat

Long

etc.

This table is a series of GPS points each having a unique ID, that I would like to be easily referenced. I've used two fields, one as serial number that is auto generated, and another that calculates the Table 1 ID using the Get(CurrentDate) and concatenates that with the serial number for that record to look like:

21/11/2016-1

21/11/2016-2

etc

 

Table 2

Table 1 ID

Observation ID

Observation details...

etc

This table is for field observations. Each of these records I would like to connect to a record in Table 1 ID to be able to locate it.

 

 

1. My first question is, how can I reset the serial number for each day so that tomorrow, the new ID's restart the serial number at one and produce 22/11/2016-1 instead of 22/11/2016-3

 

I see this example of how to reset the serial number, but am at a loss how to apply it for what I'm hoping for.

Set Next Serial Value [Invoices::Invoice ID; Max ( Invoices::Invoice ID ) + 1]

 

Basically, I would like to create a script that when the user navigates to Table 1, it would check the current date against the last entered record's date to see if the serial number needs to be reset, and resets if its required. Or something along those lines.

 

2. My second question is, how can I get Table 2's field for Table 1 ID to auto-guess based on the last record? I have it now where it will auto populate with the last record, but it still requires entering it once, but if I could get it to auto populate based on the latest record in Table 1, then that would be even better.

 

Many thanks!!

Bree

Outcomes