i2 Notebook SDK
Search results for

    Show/hide table of contents

    Unfetched property values

    The values of properties with logical types such as multipleLineString can be large. To reduce memory and bandwidth consumption, the i2 Notebook web client does not always fetch these values when it fetches records that contain them from the server. In code that manipulates property values, you must take the possibility of unfetched values into account.

    With a record in hand, you can distinguish between a property that actually has no value, and a property whose value has not yet been fetched, in two different ways:

    • Call the isValueUnfetched() method on the value of an individual property.

    • Test hasUnfetchedProperties on the record, and then call getUnfetchedPropertyTypes().

    Requesting unfetched property values

    You can request unfetched property values from within a transaction or a mutation by calling IChart.ensurePropertiesFetched(). This asynchronous method fetches values from the server for the specified properties of the specified records.

    For example:

    getToolViewApi().runTransaction(async (application) => {
      const record = application.chart.records.get(myRecordId);
      const propertyType = record.itemType.propertyTypes.get(myPropertyTypeId);
    
      // Check if the value of the property with type 'propertyType' has been
      // fetched for 'record'. If not, request the value from the server.
      await application.chart.ensurePropertiesFetched([record], propertyType);
    });
    

    For performance reasons, ensurePropertiesFetched() actually takes an array of records. It can fetch properties for many records efficiently in a small number of server round-trips. Calling it repeatedly for one record at a time results in much poorer performance and increased network use.

    Fetching property values is not itself a mutation operation, and does not form part of the undo action that a tracked mutation constructs.

    Note: The i2 Notebook web client is at liberty to dispose of property values that you fetch through ensurePropertiesFetched(). Do not rely on fetched values remaining fetched for all time.

    In this article
    Back to top © N. Harris Computer Corporation