Forum Discussion
- PaulPeterson1Qrew Assistant Captain
The easiest way I can think of to do this is with a formula query similar to this:
var text tableID = "DBID_TABLE";
var text query = GetRecords("{3.LTE." & [Record ID#] & "}AND{FID.EQ.'Value'}", $tableID);
Size($query)
Where DBID_TABLE is the table ID of the child table, FID is the Field ID of the Unique field mentioned in the child table and Value is the unique value you're using as your counter.
I used something similar to track the number of records created on a given date:
var recordlist query = GetRecords("{3.LTE." & [Record ID#] & "}AND{1.EQ." & ToDate([Date Created]) & "}");
var text recordCount = ToText(Size($query));
Year(ToDate([Date Created])) & Month(ToDate([Date Created])) & Day(ToDate([Date Created])) & PadLeft($recordCount, 4, "0")
------------------------------
Paul Peterson
------------------------------