Create object filled by another object

5
Is it possible to publish a web service in Mendix and also import this web service again? (I haven't a other solution for getting a correct list of data) And if it is possible, how to configure it so it also will be working in a localhost environment?
asked
10 answers
2

Your screenshots show that the attributes to hold the user's forecast are not members of the object in the data grid (Wedstrijd_Voorspelling), but of an associated object (Voorspellingen). Therefore, these attributes will appear as reference selectors (drop downs) in the data grid. To resolve this issue, you could move these attributes to the Wedstrijd_Voorspelling object to get a structure corresponding to my earlier answer.

answered
5

Of course it is possible to exchange web services between two Mendix applications, or even within one application. You can create a microflow, publish it as a web service, deploy and run your application, and then import the generated WSDL into the Modeler (with default settings, the WSDL is located at http://localhost:8080/ws/wsdl ). Subsequently, you can model web service calls to the imported web service in your microflows.

Even though there is nothing wrong with publishing and calling the same web service within one application, the question is why you would do that. Could you describe your problem in more detail? Maybe there is another solution that does not require web services, eliminating the overhead that is inherent to sending XML messages.

answered
5

Here is how I would go about solving your problem. When someone clicks the button to add a forecast, I would call a microflow that creates a new Forecast object and creates a GameForecast object for each Game object. The GameForecast object would be association to both Game and Forecast with using 1 : 0 associations. Aside from these associations, the GameForecast also contains an attribute that holds the forecast for that particular game.

After creating the GameForecast objects, the microflow would show a form that contains a data view on the Forecast object with a nested data grid on GameForecast. This data grid shows the data for each game (using columns with attribute paths from the GameForecast object to the Game object over the 1:0 association), as well as a column for the forecast attribute. In this form, the user can fill in his forecast for the games (e.g., using inline editing on the forecast column).

I hope this explanation helps you to solve your problem. Let me know if any of it is unclear.

answered
4

I made that object you advised. I made the form you told me to do, it doen't give me errors (also nice) but also didn't show the games. It shows a field for filling in the forecast but this fields is shown as a dropdown which isn't nice because the definition of the attribute = integer.

Any advice for solving this problem? Maybe you're interested in the MPR for a better look?

answered
3

I'm making a soccerpool (after finish also available in the Mendix app store ;). I've got a metaobject having all the games of the first round. When somebody wants to make a forecast then i want to show a dataview which is showing the games, which he can fill in with an match results and that must be saven in another metaboject called gamesforecast. Short: creating an object of mutliple records listing from the first object and written into the second object.

answered
3

Is the forecast attribute that you show in the data grid a direct member of the object that you show in the data grid? If not (i.e., if the attribute is an associated attribute), a drop down (reference selector) is rendered instead of a text box, because the data grid thinks that you want to select a referred object using that column. So to enable inline editing on the integer forecast attribute, the object in the data grid should directly contain this attribute.

answered
3

So to summarize, you want to display a list of GameForecast objects (which have a reference to Game objects) in a data grid, and allow the Integer attribute 'Forecast' (which is an attribute of GameForecast) to be editable in this data grid:

  • Data grid on GameForecast
    • Column on GameForecast_Game/Game/SomeGameAttribute => to show information about the game
    • Column on Forecast attribute, with Editable = true => to allow the user to edit the forecast for the game

If your form is structured like this, you should be able to edit the value of the Forecast attribute in a text box. The important thing here is that the column that contains the Forecast attribute should not follow a reference (or a reference selector will be shown instead of a text box). Instead, it should be a direct member of the object in the data grid (i.e., GameForecast).

answered
2

I made the reference you suggested; in the datagrid it is only one way to get the attribute in the form: via the reference selector, it is a member of the object, but it still don't work.

Do you have any suggestions to fix it?

answered
2

I made the form like you suggested, but when i made it without using a reference, there is no possibility to use the Gameobjects; I made some screenprints of it; perhaps it helps:

alt text alt text alt text

answered
1

Ok. I changed my metamodel and i able to edit the attributes! That's a step into the future for me ;). But there are no games to show, so that means that the microflow i made isn't correct. This is how i made the microflow:

first activity: List Retreve of Games second activity: Create Object of Forecast.

What am i doing wrong?

answered