Querying for a child record on parent's view screen RRS feed

  • Question

  • I have an Order and OrderDetail table in a one to zero or one relationship (not 1-to-many, as you might think.)

    On the (HTML client) View screen for the Order table, I need to find out whether the order has an OrderDetail record.  What are some good ways of doing that?

    Saturday, March 29, 2014 9:56 PM

All replies

  • Here's what I have so far.  If someone knowledgeable could tell me if I'm on the right track or way off I'd be grateful.

    In the Parent View screen  in question I have button that checks if a child record exists or not.  It goes like this:

    myapp.ViewParent.HasChild_execute = function (screen) {
        var newChild;
        screen.Parent.getchild().then(function (child) {
            if (child === undefined || child === null) {
                console.log("no child record..creating one.");
                newChild = new myapp.child();
                newChild.Created = Date.now;
                newChild.SomeField = "some value";


    Monday, March 31, 2014 4:39 AM
    • Edited by joshbooker Wednesday, April 2, 2014 4:22 PM
    Wednesday, April 2, 2014 4:20 PM