How to change a data Container with a custom dropdown?

0
Hello all, I am relatively new to Mendix and am trying to implement my first small project. I'm using an external MySQL database where all data are stored. In Mendix I would like to display this data.   TL;DR; can be found at the end.   For testing purposes, my database looks like this: Table “mendix_dropdown” This table has two columns: “drop_id” and “drop_label” with some test values. Table “mendix_list” This table has three columns: “list_id”, “column_a” and “column_b” with some test values.   My Plan is, to show all values from table “mendix_dropdown” in the custom dropdown andf when i select one item in this dropdown, the list view should show me all values from the table “mendix_list” with the selected index.   My problem is, the list view is not loading.   This is my code:   i have two entitys:   This are my container:       My microflow “GetDropdownContext” create a entity from my DropdownContext for my data view.         In my DataView there is the custom Dropdown        The Source for this view is an other microflow. It create an object from my Dropdowncontext and execute a query to get all values from my database. This microflow return a list.   Page:     My Problem is, i want to change the list View when i change the drop down. For this case, i have a new microflow GetList. This creat an Object from my entity List and run a Select on my database with the parameter search.     For the test, i’ll show what i picked:     After i changed something in the dropdown, the microflow should take my selection and run a Select statement on my database and should return only the values for this id.     But my ListView always show “No items found”   I don’t get any error and i think my Query is running.     TL;DR; How can i change a container dynamically (list view, datagrid, galary, etc.) with the selected value from a custom dropdown from an external MySQL database? Im using: https://marketplace.mendix.com/link/component/117326   Best regards Michael                    
asked
3 answers
0

Hello,

 

I tried to understand your problem as much as I could. In your case, have you checked if the ‘GetList’ microflow is being triggered every time the item in the drop down is selected?

 

Also, there is no need to store your listview in the footer of the Dataview. If you can, you should put it in the body right underneath your drop down.

 

You might have a refresh issue here along with a few issues anyway.

 

Firstly, You are creating an object type of DropDownContext as a datasource microflow on your page. This microflow only has a create action so if the context object was to be refresh, it will create a new object each time which means you may lose your selection.

 

Secondly, Many other issues

 

If I was you, this is how I will structure my entity

 

 

Your dataview page context, should be the dropdown wrapper which will store many dropdownContext objects (In the dropdown)

Each DropdownContext should have a list of their own (I am assuming that this is what you are doing)

 

In your page, you can retrieve the list via association with the DropdownContext.

 

In your case, you might not need to do this as you want a new list on every selection so just make sure your logic is triggering each time you select a value in the dropdown, this will mean the context is not refreshing

answered
0

Hello,

 

I think i found my problem.

My dropdown has an event. After every change, start the microflow.

It looks like, my SQL Statement isn’t working.

This is my microflow:

 

 

For test purpopse, I added some info messages.

 

Everytime i change my drop down, i get this info:

You can see, i get the correct value from the dropdown.

 

BUT, my query does not give me a value back.

This was my first try:

 

I get no error and no value back:

 

But when i change my SQL to this:

I get a list back.

 

Because it is always the same sql statement, the value isn’t changing.

How can i run the SQL statement with the parameter?

 

I already created a variable but this is also not working:

 

Also when i write the complete string into my variable and just call it, its not working.

 

How can i get access here to my value from the variable?

 

Best regards

Michael

 

 

 

 

 

 

 

 

 

 

answered
0

Hi Michael,

 

Probably best to set up a call so that I can help you through debugging your microflow.

Send me an email and let me see how I can help.

answered