Page tree
Skip to end of metadata
Go to start of metadata

This API sets the current position of a multiple-occurrence data structure.


  1. Data structure - A Profound.js data structure field defined by pjs.define() with the "occurs" option.
  2. Occurrence number - The occurrence number to set to. The first occurrence is 1.

Exception Handling

An Error instance will be thrown if there are any problems setting the occurrence.


Set/get multiple occurrence data structure
  pjs.define("customer", {type: "data structure", qualified: true, occurs: 2, elements: {
    "number": {type: "integer", length: 10},
    "name": {type: "char", length: 100, varying: true}
  pjs.setOccur(customer, 1);
  customer.number = 123; = "ACME Corp.";
  pjs.setOccur(customer, 2);
  customer.number = 456; = "John Doe Institute of Anonymity";
    Customer 123 = ACME Corp.
    Customer 456 = John Doe Institute of Anonymity
  for (var i = 1; i <= 2; i++) {
    pjs.setOccur(customer, i);
    console.log("Customer %d = %s", customer.number,;

RPG Equivalent