'Mendix Retrieve last input value

In mendix i have 2 pages: Course Overview and Course_newEdit.

As the names suggest overview i the overview page and the second one is edit page.

The entity name is Course. Its attributes are: Name String and Description String.

I have a requirement that i when a user edits course, the default value for name should be the last user input value.

So if the user has give first course name as History. The second time any user tries to input the name, it should by default show History.

how can this be achieved?

I couldn't find any option for the same in the default settings.

Mendix 9.2 pro



Solution 1:[1]

If you are editing an existing course than it will automatically show the value that was last stored in the database so you don't need to do anything there.

If you are creating new course and want the default value of 'Name' attribute to be automatically filled in using the previous course object, than you have to retrieve last saved course object from database with range option = 'First' and add sort property that can identify the retrieve object as last saved course object. Than you can use retrieved last saved course and copy 'Name' to your new course object. Please check out Mendix Forum and Mendix Slack Community if you have more questions.

Mendix Forum: https://forum.mendix.com

Community Slack: https://join.slack.com/t/mendixcommunity/shared_invite/zt-hwhwkcxu-~59ywyjqHlUHXmrw5heqpQ

Solution 2:[2]

first you need to retrieve the list "Course" from database then sort the list by creating date descending then retrieve head of the new sorted list then fill this object in the new created one course/name

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dharman
Solution 2 Alaa Hesham