Store data from one entity to another after processing

0
Hello, I am trying to write the data read from a database into an entity "StringTable" into another entity "StringValues". To do this, I create a list from the StringValues entity by the retrieve action. Then I filter the data of the entity "StringTable" and let the maximum of an attribute "ts" be recorded in a variable. Then I wanted to write this maximum into the list of the Retrieve Action. However, I did something wrong with the syntax. I tried the following syntax: This is the whole flow: How can I solve this problem? I could really need some help
asked
3 answers
0

Hey Sophia Maurer!

 

First of all, your current syntax is not correct cause you don’t need to set “;” at the end of an expression on Mendix.

If you remove that char you will have the problem that you are trying to insert a comparison on a list. The result of the “=” expression is a boolean and your list contains objects of the StringValues entity then this is going to lead in an error.

 

To fix this I don’t understand exactly what you want to build. If you want to get the maximum probably you should use an aggregate list function on your microflow, However, you are going to obtain a variable that is not a StringValues object. 

 

To be able to insert on that list the maximum should be stored on a StringValues object as an attribute and if you have that object you can directly add it to the list.

 

If you have any other question, please let me know

answered
0

You are trying to code in Mendix, which doesn't really work.

 

Mendix is object based. And an object is a copy of a entity defined in the domain model.

So if you fetch data using the database connector, it IS already mapped to an entity. Either you can directly store (commit) these objects to the database.

In case your returned object as result of your SQL query via de the database connector is different to how you want to store it in the database, then you need to map the returned OBJECTS to a new created OBJECT based on a entity.

 

Not completely sure what the scenario and goal is of this microflow and your query, so hard to explain what you need to do.

A first idea is; iterate over the list of strings and create a new object where your want to map your values to.

 

Also, not sure but did you take the rapid developer course online? this will help you to understand the principals of Mendix. And We are always open to help you more and explain the secrets of Mendix at the Low-code Academy

 

answered
0

Thank u I looped over the list and created an object depending on if queries, is there a switch case in Mendix? I didn’t find one and like this its really elaboretly

answered