Discussions

 View Only
  • 1.  Executing JS numbering code

    Posted 09-01-2017 07:39
    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.


  • 2.  RE: Executing JS numbering code

    Posted 09-01-2017 12:47
    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
    https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=596

    Notes:

    (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.