locked
Alternatively pass object or PrimaryKey to screen RRS feed

  • Question

  • My main problem with LS is not being able to use the default View- or AddEditScreen, both by passing the object or then alternatively passing the PrimaryKey of the entity.
    I usually know the PrimaryKey as I have to build the Browse screen using a RIA-service, ie. joining with some user-tables etc. to only browse those records the user owns.

    To pass the PrimaryKey to eg. View-screen, I have to change the View-screen as so; remove the default query, insert a new "SingleOrDefault"-query of the same entity, add a screen parameter and bind the screen-parameter to the Query parameter.

    Is there a way to use the default View-screen (Or AddEdit-screen), adding the screen-parameter and being able to choose whether passing the object or the PrimaryKey?

    Something like this as you want to pass the PrimaryKey:
    var tKnownPrimaryKey = screen.RIA_Browse.selectedItem.ConstructionId;
    myapp.showViewConstruction(null, tKnownPrimaryKey);

    And like this as you want to pass the object:
    myapp.showViewConstruction(screen.Constructions.selectedItem, null);


    Sometimes I relate the entity (eg. Construction) to the RIA-service already in the browse-screen to always have access to the object, but that's not always viable and I don't know if that's very effective.

    By the way, I'm very content with LS keeping the programmers on the same road, still allowing for by-roads. I haven't seen something similar from MS before.

    Regards Roger.

    Wednesday, April 29, 2015 8:37 AM

All replies

  • Hi RogerExp,

    I am trying to do what you describe you do in your second paragraph.  How do you add a screen parameter and how do you pass the parameter value to the view screen?

    I have been trying to figure this out for a day.

    Thanks in advance

    Saturday, May 13, 2017 4:03 PM
  • For willContest:

    Next:

    After that, you have this on screen, so click and go to properties:

    When you check "IsParameter" you will have acces to this from JS/Code in application.

    Is this what you need?


    Wednesday, May 24, 2017 11:43 AM
  • It depends on scenario what do you want. Its better to pass object like a parameter, not only ID because sometimes your object (in application) will not have ID (ex. new created object). So i suggest to pass always object, and if you doesnt have object, id only, to get this object from database first.
    Wednesday, May 24, 2017 11:51 AM
  • Thank you Tomasz.  Your post assisted me greatly!
    Wednesday, May 24, 2017 1:20 PM