Skip to main content

Count the number of Records in a Table using Script

  • September 30, 2022
  • 1 reply
  • 21 views

Forum|alt.badge.img+6

Hi All,

I am using script to assign a unique ID to a household. Part of doing this includes counting the number of records that currently exist in the table that the unique ID will be assigned to. I am struggling to obtain this count.

I created a column in the table using the Autonumber function that automatically assigns a number to a new record - in an ascending manner. I then us the input.config() method to try obtain this value of the most recently created record. But I get an undefined return from this.

Any ideas on another way to do this?

Thanks in advance.

Cheers,
Ryan.

1 reply

kuovonne
Forum|alt.badge.img+29
  • Brainy
  • 6009 replies
  • September 30, 2022

Why not use the autonumber value as the unique id? It is guaranteed to be unique.

Also, the value of the most recent autonumber is not a good way to determine the number of records in a table. If you delete any records, the autonumber will be greater than the number of records.

Did you setup the input variable in the left panel of the editor?