Mobile: Drop down list crashes since data fetched from local database

Mobile: Drop down list crashes since data fetched from local database

  

Hi,

I'm new to Outsystems and are currently doing the mobile exercices.
I'm at the chapter where I need to create the local database.

I'm having problems with the Drop-down list ever since i got the data to be fetched from the local database. when testing the app after publishing it, the Drop-down list doesn't show any record and the app eventually crashes.


Please help!!!

Hi Gael,

"The app crashes" is very vague. What happens exactly? Do you see any errors in Service Center? Do you get this behaviour on both a device and in the browser?

Hi Kilian,

Thanks for replying.

After investigation, I understand that the app crashes because the drop down list field is empty and I sort of set it up that way.

The real issue is that this drop down list is not showing any records ever since I changed its source to get data from the local database, instead of the server database.


Hope I was clearer :s

Well, it shouldn't crash just for not having data (and I still wonder what "crashing" means in this context), and it should be perfectly possible to use a Local Entity (I just ran a test and it works without a problem). So there must be something else going wrong.

(and I still wonder what "crashing" means in this context) =  I dont know if you're familiar with the exercices (Mobile: Local storage), but by clicking the save button, a new task is supposed to be saved and added to the task list when all requested info are entered. When I do click on save, i get the error message that you see on the screenshots i provided. Also, my drop down list is empty for some reasons, whereas it should be holding values.

Would you  be able to advice on why the records of the dropdown list are not being displayed?


See attachements / photos

Well, the error message makes sense, as you are trying to save a record that has an Attribute that's set to Mandatory, but is empty (that's not "crashing" btw :)).

As for why the list is empty, I can't see. Can you attach the eSpace OML here so I can take a look?

Hi Gael,

The problem of "crashing" is related with the dropdown not having any values. Thus, it tries to create a Todo record with an empty Category and since the CategoryId attribute is mandatory in the Entity Todo it throws an exception in the database.

Can you share the properties of your dropdown widget?

Cheers,

José

Kilian Hekhuis wrote:

Well, the error message makes sense, as you are trying to save a record that has an Attribute that's set to Mandatory, but is empty (that's not "crashing" btw :)).

As for why the list is empty, I can't see. Can you attach the eSpace OML here so I can take a look?

Hi Kilian, 

please see attachement


José Costa wrote:

Hi Gael,

The problem of "crashing" is related with the dropdown not having any values. Thus, it tries to create a Todo record with an empty Category and since the CategoryId attribute is mandatory in the Entity Todo it throws an exception in the database.

Can you share the properties of your dropdown widget?

Cheers,

José

Hi José,

Thanks for the reply.

Please see the attachement


Hi Gael,

The CategoryId is Mandatory in LocalToDo, so you should set the Dropdown1 to Mandatory. This will set the Form1.Valid to False, so at least the app will not try to save something that's mandatory but empty (you should add a message there though, to inform the user).

As for the root cause of this (the Category being empty), when the error occurs, are you creating a new ToDo? Do you have any ToDos already in the database? If not, are you sure the LocalCategory Entity has any entries?

Hi Gael,

Have you created any Categories in your mobile app? I think that is the problem.

And by looking at your oml, in fact it does not have any screen or action to create Categories in Local Storage.

The bootstrap of the Categories only works for the Database Enitites. The records of the Categories from Local Storage must be synchronized from Database.

Thus, before testing your app you will have to do Part 4 (Synchronize  Data  to  Local  Storage) of the Local Storage exercise.

Cheers,

José

Kilian Hekhuis wrote:

Hi Gael,

The CategoryId is Mandatory in LocalToDo, so you should set the Dropdown1 to Mandatory. This will set the Form1.Valid to False, so at least the app will not try to save something that's mandatory but empty (you should add a message there though, to inform the user).

As for the root cause of this (the Category being empty), when the error occurs, are you creating a new ToDo? Do you have any ToDos already in the database? If not, are you sure the LocalCategory Entity has any entries?

The CategoryId is Mandatory in LocalToDo, so you should set the Dropdown1 to Mandatory. This will set the Form1.Valid to False, so at least the app will not try to save something that's mandatory but empty (you should add a message there though, to inform the user).==> Got it :).


As for the root cause of this (the Category being empty), when the error occurs, are you creating a new ToDo? Do you have any ToDos already in the database? If not, are you sure the LocalCategory Entity has any entries?

==> I had a few "To Dos" already before changing it to be fetched from the local database. And yes it occurs when i'm trying to create a new To Dos


José Costa wrote:

Hi Gael,

Have you created any Categories in your mobile app? I think that is the problem.

And by looking at your oml, in fact it does not have any screen or action to create Categories in Local Storage.

The bootstrap of the Categories only works for the Database Enitites. The records of the Categories from Local Storage must be synchronized from Database.

Thus, before testing your app you will have to do Part 4 (Synchronize  Data  to  Local  Storage) of the Local Storage exercise.

Cheers,

José

I'll try that and come back to you as soon as.. Hope that fixe that issue :).

Thanks