Executing JS numbering code

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • In Progress
I have developed JS code for numbering of records of an existing application. It should number the already existing 1000 records; as well as any further new records. After saving the page in the application-pages, how to execute the task of numbering of old records.


  • 120 Points 100 badge 2x thumb

Posted 2 years ago

  • 0
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,024 Points 20k badge 2x thumb
A script similar to this entered through the console would number all existing records in the specified table in check numbering order (101, 102, 103) where the counting field was fid=6:

Pastie Database


(1) the basic idea is to build an array of rids containing the [Record ID#] of all existing records and to transform it into a blob of CSV which can then be imported using API_ImportFromCSV.

(2) You will need to implement your numbering code in place of my check numbering code show in bold below
 var csv = "";
  rids.forEach(function(rid, index) {
    csv += rid + "," + (101 + index).toString() + "\n";
(3) You didn't specifically ask about how to number new records but the general idea there is to query for the most recent record, extract its unique number, increment it and stuff this new numbering value into the the appropriate field on the ?a=nwr form.