Dropdown values coming from a Form are not being stored in the database
Application Type
Mobile
Service Studio Version
11.50.11 (Build 47949)
Platform Version
11.13.0 (Build 31107)

I'm building an app and the values of my Popup are displayed properly:

However, when I store them, they are not saved:

I'm wondering what I'm doing wrong, I configured the save like this:

I also tried to change the ID for the correct one:

But it gives an error:

OutSystems doesn't allow me to change the id for the correct one:

Also, I cannot edit it in the data view:

Also it's adding the data in other 2 "unknown" columns:

I understood those were relationships, not new columns in my table.

Is it any bug? Or there is no way to create the correct foreign keys connections?

Any idea how to fix it? 

Thanks.

MyShoppingList.oml

Solution

Thank you!! Well, First I understand you, it's not easy, but first, your question is answered and now you know what and where to save it. One way of saving something new is to give the LocalUserid2 value saved to the LocalUserId and the same thing for the ProductId


One other thing I needed to change was the auto number property on your entity, because without that, every time you were creating something, you were creating on top of the last or current record.

Another thing, was, in your bootstrap, I removed the if the condition that was ending the flow because if there was data, he didn't create anything from the excel.

Now, it is creating and displaying the right data, with all the previous info I gave.

And still with the same attributes.

I hope this helps you

Kind Regards,

Márcio

MyShoppingList.oml

Hello, first, what i would do is debug, then see what was not coming and what was coming.

As you can see the data is not being uploaded.

What I could see is, in your table, you have the localUserId and the productid on the expression and on the popup, you are saving on the localuserid2 and productid2 attribute

You are doing everything ok, but you are displaying something that is not being saved on the popup as you can see in your next screenshot

Kind regards,

Márcio

Hi Márcio,

Thanks for your answer, but if I change the Id for the correct one, I still get an error:


The app doesn't allow me to change the id for the correct one:

Also, I cannot edit it in the data view:

Is it any bug? Or there is no way to create the correct foreign keys connections?

Do this, delete the ProductId, and the LocalUserId, and maintain the foreign keys. You will not need to have those foreign keys duplicated. After that, put on the table the correct foreign keys, and save with the correct foreign keys.

Maintain just this

And then on your bootstrap put this,

IntegerToIdentifier()

Why?

Because you are receiving integers and you want to save it as an identifier, to do that you need to convert the integer to identifier.

With that, you will be able to the things the correct way.


I am giving this answer not knowing why you previously had foreign keys duplicated. But I think it was because at the beginning you needed to import the excel.

Let me know if now is ok.

You can check too on the oml i shared

Kind regards,

Márcio

MyShoppingList.oml

Hi Márcio, and am I not going to lose my data using this workaround? The other cases as you could see in the image they are empty (0):

I cannot visualize this workaround as a feasible solution if this was a production app. I wouldn't imagine myself if I was updating 1,000,000 records or more. I have had some massive Excels and DBs to handle over the last 14 years.

Personally, I'm checking OutSystems if it's a feasible solution for future apps but I can visualize tricky workarounds that I have already highlighted here:

Federico Navarrete's ideas

All this happened in less than a day of using the platform. I consider most of them as bugs and not exactly as new features.

Any idea if there is a way to create properly the Foreign Keys? Because as I expressed before, I don't imagine myself in this scenario in a large and complex production env.

Thanks for your time.

Yes, you are right!

Let me do a question. Why do you have these attributes duplicated?

LocalUserId

LocalUserId2

ProductId

ProductId2

I will see a good workaround anyways

That's a perfect question Márcio and here are my answers:

I explained in detail each action that I performed. I'm acting as a blind person and using as low code (if it's possible no code) as possible. I have created several apps over the years and this won't be a major problem in normal RDBMSs just a simple (MySQL):

CREATE TABLE Orders (
OrderID int NOT NULL,
OrderNumber int NOT NULL,
PersonID int,
PRIMARY KEY (OrderID),
FOREIGN KEY (PersonID) REFERENCES Persons(PersonID)
);

Source: SQL FOREIGN KEY Constraint (w3schools.com)

Thanks for your time.

Solution

Thank you!! Well, First I understand you, it's not easy, but first, your question is answered and now you know what and where to save it. One way of saving something new is to give the LocalUserid2 value saved to the LocalUserId and the same thing for the ProductId


One other thing I needed to change was the auto number property on your entity, because without that, every time you were creating something, you were creating on top of the last or current record.

Another thing, was, in your bootstrap, I removed the if the condition that was ending the flow because if there was data, he didn't create anything from the excel.

Now, it is creating and displaying the right data, with all the previous info I gave.

And still with the same attributes.

I hope this helps you

Kind Regards,

Márcio

MyShoppingList.oml

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.