locked
Accessing related entities in javascript RRS feed

  • Question

  • I have a USER_FIELD_TEMPLATE entity which can contain 0 to many USER_FIELD_REPLACEMENTS entities

    So I'm loading these and want to iterate through the replacement values; There's 11 template records, and each one has varying numbers of replacement values.

    myapp.activeDataWorkspace.<database>.qGet_UserFieldTemplates().expand("USER_FIELD_REPLACEMENTS").execute().then(function (result) {

             var y = result.results[0];

    I grab the first one (y) which has 2 USER_FIELD_REPLACMENT records. Properties of template entity coming through no problem;

    ?y.Name

    "FirstName"

    When I access the related entity I can't seem to figure out how to access the properties;

    ?y.USER_FIELD_REPLACEMENTS

    {...}

        [prototype]: {...}

        _data: {...}

        _details: {...}

    ?y.USER_FIELD_REPLACEMENTS._data

    {...}

        [prototype]: {...}

        linkSet: {...}

        query: {...}

        state: 1

        value: {...}

    Anyone done this before?

    Thursday, February 2, 2017 1:28 AM

Answers

  • Searched before posting, but searched again on "Lightswitch .expand" and found the answer.

    y.USER_FIELD_REPLACEMENTS.array[index].<Property>

    Working great.. on to the next roadblock

    • Marked as answer by dcagamer Thursday, February 2, 2017 5:30 PM
    Thursday, February 2, 2017 5:30 PM