19
Views
9
Comments
Solved
My dropdown is inserting the same product when i select other product
Application Type
Traditional Web

Hello, my dropdown is inserting the same product when i select other product. How i solve it?



Rank: #95
Solution

Hello again Francisco,

Thank you for sharing your OML file.

Your Save screen action from Compras_Itensdacompra_PopupEditor seems to be fine, since you're passing the entire record and the fields are correctly bound to the attributes.

I believe your problem is in CompraDetail screen. In your table column Produto, you're passing this value:


But the Aggregate GetProdutoes is just retrieving all the rows from Produtos entity (with no conditions):

So GetProdutoes.List.Current record will always be the same. That's why you see the same value in the screen. You're probably saving the correct values in the database but displaying them incorrectly.


You need to add Produtos entity to your GetItensdacomprasByComprasId Aggregate (this is the query that you use to populate the table):

Because you want to display the respective Produto for each Itemdacompra. So you need to join these 2 entities by ProdutosId.

(Also you don't need to have GetProdutoes Aggregate after these changes)


Back to the expression in the table column, you need to define it as the resulting value from the Aggregate:


Please refer to attached OML file with these changes.


Let us know if it solved your problem! :)


Kind regards,

Rui Barradas

VendasWeb.oml

Rank: #95

Hello Francisco,

Hope you're doing well.

Can you please verify if you are saving the correct Product when you are creating the new record in the Database?

Or can you share your OML file so we can take a look?


Kind regards,

Rui Barradas

Rank: #495

Hello Francisco,

In addition to Rui's said, Is the product field is an identifier for the entity?

If it's no, what entity action used by the "Save" button clicked?

The best way is to share your OML file so we can take a look? 

Kind regards,

Rank: #187

Hello Francisco, did you debug to check if you are passing the correct identifier?

can you share the oml?

cheers,

Carlos Lessa

Rank: #3239

Good Morning,


I'm sorry but I think I have the same problem as Francisco.

Please see my post

https://www.outsystems.com/forums/discussion/67458/register-values-in-the-database/


Thanks