Jump to content
Server Maintenance This Week. ×

Number of records in a specified table


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

Recommended Posts

I require a way to formulate the number of records in a specified table. I've looked through the function list but to no avail. 'Get' functions have no parameters and so can only display the number of records in the current table which is useless as I want to use this as part of a trigger for a script. Alternatively something that triggers when a new record is created in a specified table would do. I find it hard to believe that something so simple doesn't exist and am consequentially betting that the function exists under a confusing title. So, does anyone know what it is? I suppose if the worst comes to it, I could make a custom formula that lists all record UIDs from a table and counts them but I'd rather not if a function already exists...

Link to comment
Share on other sites

Unfortunately the function Get ( TotalRecordCount ) or Get ( FoundCount ) is context sensitive requiring you to be on a layout for the table in question. Therefore your script would require you to switch layouts to get that value.

You could open layouts "off screen" by declaring a negative value of say -5000 top, go to layout grab value in variable then close that window.

Alternatively with a plugin that does SQL queries you could also grab this info without switching context.

I had discovered this same seemingly simple task - and ended up using AppleScript to get the record counts.

Link to comment
Share on other sites

You could open layouts "off screen" by declaring a negative value of say -5000 top, go to layout grab value in variable then close that window.

Good idea but possibly too complex for me. It will be easier (although less elegant/robust) to do what my Uncle suggested (I e-mailed him as well as posting here) and control the way the new record is made with a script invoked by a button,

rather than using the native 'New Record' application command. The button could then also run the script I want. I was thinking of building a kisok friendly/custom button driven system anyway. I appreciate the quick reply and I hope this thread may be useful to people in the future!

Link to comment
Share on other sites

1. Create a field in the tables you want to count that is unstored get(RecordNumber) - I use zcRecordCurrentNumber

2. Create a relationship from the Table Occurrance you want the count from that includes all records

3. For each table (or you could combine) use the calc Last ( Relatedtable::zcRecordCurrentNumber )

That's it.

Cheers

Tim

Link to comment
Share on other sites

  • 3 weeks later...

1. Create a field in the tables you want to count that is unstored get(RecordNumber) - I use zcRecordCurrentNumber

2. Create a relationship from the Table Occurrance you want the count from that includes all records

3. For each table (or you could combine) use the calc Last ( Relatedtable::zcRecordCurrentNumber )

That's it.

Cheers

Tim

Just to say that I ended up using this method for another reason and it worked perfectly - thanks Tim!

Link to comment
Share on other sites

This topic is 5103 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
×
×
  • Create New...

Important Information

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