Script to load a table from a form

Viewing 2 reply threads
  • Author
    Posts
  • April 6, 2019 at 10:50 PM #34309

    Rob Young
    Participant

    I want to populate a task list form (form A) from a reusable set of activities for things like preparing to travel and setting up camp with my travel trailer and tow vehicle. I created a form (form B) with task fields and created several records representing activities. I created the task list form with a date field and a table (columns names matching the field names in form B). I’ve successfully manually loaded the table in form A with the fields and filtered records from form B. I would like the table in form A to be automatically loaded with a filtered and sorted set of rows from form B when a new record is added to form A. Is this a job for a script? Is there a script example I can use to accomplish this?

    Thanks in advance for any help!

    April 7, 2019 at 1:31 AM #34310

    Brendan
    Keymaster

    Hi Rob,

    Basically you would need to use the record.addRecordToField(someRecord, field_id); which takes a record (someRecord) that you’ve already created and adds it to the Table field with field_id. Or use the var newRecord = record.addNewRecordToField(field_id); function to create and return a new record which you could then populate since it passes back a reference to the new record just added. The field_id would be the ID of your Table field.

    Thanks!

    Brendan

    March 24, 2026 at 9:44 AM #53791

    Steve-Kai Vyska
    Participant

    Hello,

    i want to open this discussion for one more Question. I want to add more then one Record at the some time to a table.

    So I created a loop which reads another table, and now I want to write special data to the table. So I create a new Record with

    var newRecord = record.addNewRecordToField(field_id);

    and using

    newRecord.setFieldValue(IDofTable,myData)

    i wanted to write the data in the table. But when I put the “var newRecord = record.addNewRecordToField(field_id);” line in the look only the first record is shown, and putting it outside the look I get one the last record written to the table.

    I think I have a major mistake in understanding how the date is written. btw even document.saveAllChanges() doesn’t do anything different.

Viewing 2 reply threads

You must be logged in to reply to this topic.