locked
Parent Entities not loading RRS feed

  • Question

  • Im having a really strange problem, it's hard to explain but i'll try to break it down the best i can. It started to happen last week in a production app but i can't find where the problem is.

    I'll reproduce the steps on a newlly created App (it's codeless) and hope anyone has an ideia of what might be going on.

    The Setup:

     - I created a new HTML project from scratch. It has an External Data Source, a SQL Server 2014 DB. 

     - The Model has an entity named Events. The Events have many "Parents", namely, a Local, an Entity, a Category, a Language, an Organization, a Public, a Type, a Status and a State. These are all one to Many(Events) relationships. 

    - I created a Browse Events Screen and an Add/Edit Events Screen. I added a button to the Browse screen that navigates to the Add/Edit Screen to Edit the Selected Event. 

    - No code, extensions or anything were used.

    The Problem:

     - None of the Parents are loaded.

     - Throughout the app, on other entities, the same thing happens, although some are loaded, some are not.

    What i've done so far:

     - I created a View Events Details Screen. Everything is loaded correctly. Afterwards the Event in question gets loaded correctly on the Add/Edit Screen. (Going back to the browse screen).

     - I Fiddle'd and F12'd to find out that the services are being correctly loaded - all of the "Parents" were fetched in the Odata service.

     - I reproduced the App on my colleague's station. Everything works fine. We checked our versions and noticed he was using msls.2.5.1 and i'm using msls.2.5.2. He then reproduced it with msls.2.5.2 and Bam - Same problem.

    - I added an EventSingleorDefault query to the AddEdit screen, wired it up to an ID and passed the ID as a parameter. Then i set the Event on the created method using the EventSingleOrDefault. Everything works fine.

     - This DB Model was under a lot of changes last week so i decided to make one more test. I loaded an old(different) Project DB Model, but this one is on SQL Server 2012. It has a simillar entity. Everything works fine here.

    What i'm thinking:

     - I don't think it has anything to do with the msls.2.5.2 (although it's really strange that everything seems ok with 2.5.1).

     - I do think it is related with the sql db but everything seems normal..

    Anyone has any ideia what could be causing this?

    Tuesday, June 9, 2015 10:10 AM

Answers

  • After a lot of ___(fill with what one does to find and debug these things), i found the problem.

    Beside the mentioned fields, there were also bit fields, dully converted to FlipSwitches in the app.

    On this model, those bit fields are nullable (they were added last week). When i removed them from the screen, everything loaded normally. Added them again and problem came back. (On my other testApp all the bit fields were not nullable ).

    So i compared the msls-2.5.1.js with the msls-2.5.2.js and on the FlipSwitch Control (arround line 20484):

    msls-2.5.1.js

     me._refreshView();

    msls-2.5.2.js

     if (me.sliderValue === undefined || me.sliderValue === null) {
                me.sliderValue = false;
                return;
            } else {
                me._refreshView();
            }

    I removed the code and changed it to the 2.5.1 portion (just the me._refreshView();) and everything is working.

    I'm not sure if i should have done it, it must be there for a reason... I'm still not sure what was happening too.


    • Proposed as answer by ADefwebserver Wednesday, June 10, 2015 7:52 PM
    • Marked as answer by Nuno Dâmaso Wednesday, June 10, 2015 11:32 PM
    Tuesday, June 9, 2015 3:27 PM

All replies

  • After a lot of ___(fill with what one does to find and debug these things), i found the problem.

    Beside the mentioned fields, there were also bit fields, dully converted to FlipSwitches in the app.

    On this model, those bit fields are nullable (they were added last week). When i removed them from the screen, everything loaded normally. Added them again and problem came back. (On my other testApp all the bit fields were not nullable ).

    So i compared the msls-2.5.1.js with the msls-2.5.2.js and on the FlipSwitch Control (arround line 20484):

    msls-2.5.1.js

     me._refreshView();

    msls-2.5.2.js

     if (me.sliderValue === undefined || me.sliderValue === null) {
                me.sliderValue = false;
                return;
            } else {
                me._refreshView();
            }

    I removed the code and changed it to the 2.5.1 portion (just the me._refreshView();) and everything is working.

    I'm not sure if i should have done it, it must be there for a reason... I'm still not sure what was happening too.


    • Proposed as answer by ADefwebserver Wednesday, June 10, 2015 7:52 PM
    • Marked as answer by Nuno Dâmaso Wednesday, June 10, 2015 11:32 PM
    Tuesday, June 9, 2015 3:27 PM
  • I was able to reproduce this with an Intrisic ApplicationData DataSource.

     - New HTML LS Project

     - Table Children ; Field: Name - Type: String ; Field: BitTest - Type: Boolean (Not Required)

     - Table Parent ; Field: Name - Type: String

     - Relation one(Parent) - many(Children)

     - Browse Childrens Screen with a Tile List. Only the Name on it (if the bit field is loaded here, the problem doesn't exist). 3 Buttons: Add Children; Edit Selected Children; Add Parent

     - AddEdit Children Screen. Added a method to manually set the bit field to null. (it defaults to false when the FlipSwitch is loaded)

     - AddEdit Parent Screen to add a Parent.

     - Added a Parent P1

     - Added a Children C1, Parent P1, executed the method to set the bit to null.

     - Selected C1 on the Browse Screen. Edited the selected children.

    Parent doesn't load.


    Tuesday, June 9, 2015 10:24 PM