Hi Everyone,
I'm encountering a problem in my application, and I hope someone here can help me figure it out. Here's the situation:
I have a list and an agenda. The agenda gets populated when data is entered in the list under Date MS1, Date MS2, and Date MS3. In the agenda, you can also set time slots, which auto-generate a start time and an end time. So far, so good.
The issue arises when I save everything and return to the project list - the project list appears empty!?! When I go back to the agenda, it’s almost completely empty too; only the times remain. I'm confused as to why the save workflow isn't working properly, and I have no idea what could be causing this behavior.
Additionally, I want to retain the ability to make manual changes in the agenda (e.g., adding or removing rows) without those changes affecting the project list.
I'm grateful for any tips you can share, and I’ve attached a sample OML file to this question as well.
Thanks in advance!
Best regards
What happens when you debug your save actions ?
Hi,
I see a problem with your GenerateTimes action. It recalculates and updates the Start/End times every time the script is triggered, even when no underlying data has changed. This leads to false positives in your UpdateList, meaning all rows are marked as updated. As a result, the subsequent update logic overwrites the actual user changes because you are effectively updating the entire record, not just the modified fields.
This issue is amplified by a second problem in your data preparation logic.
You are appending the same list three times, with only the MS_Date value differing. In this setup, updates become ambiguous unless each row has a unique identifier. When updates are performed based solely on Id, there is no reliable way to determine which duplicated row the user actually edited, which can lead to incorrect or multiple updates.
Additionally, the third append is incorrect, as it maps MS1 again instead of MS3. MS3 is defined as Text in the entity, while the other MS fields are dates, which introduces inconsistency and potential type issues.
________
To provide more concrete guidance, we would need additional details about the intended use case. However, an initial recommendation would be to avoid duplicating rows altogether. A cleaner approach would be to add an action column that opens a popup where all three MS dates can be viewed and edited in one place.
Thank you for your thorough response and the detailed feedback!
The use case I aimed to showcase with the sample OML is this: we have a project list where we add our date entries for the respective milestones (MS1, MS2, MS3, etc.). Based on the entries in the project list, the meeting agenda should be filled with one separate row per MS date. At the same time, the meeting agenda must exist independently, serving as an overview of all upcoming meetings. Crucially, it should also be possible to add or remove rows manually in the agenda without impacting the project list.
I see your point regarding the GenerateTimes action triggering unintended updates and overwriting user changes. Do you have any suggestions on how I can modify the GenerateTimes action to avoid this behavior? Specifically, how could I limit it to update only the newly inserted rows or rows that actually need recalculations, rather than inadvertently tagging all rows as “updated”?
You’ll need to update your data model. The project list, agenda, and milestones should be represented by separate entities. Also, is the number of milestones fixed at three, or should it be flexible and vary over time?
Regarding the issue on the List screen, the grid isn’t populating correctly because the column bindings must match the structure you pass to the grid. In your case, you need to output a structure that explicitly contains all the attributes you want to display or edit in the grid.
Thank you for your answer!
So just to confirm, should I create separate structures for the project list, agenda, and milestones? Or would using local variables for these (e.g., lists or records) be sufficient for this workflow?
Regarding the milestones, the number of milestones is fixed, so there will always be exactly three (e.g., MS1, MS2, MS3). Does this simplify the entity and structure setup, or should I still consider splitting them into separate entities for better scalability or handling?
Thanks again for your guidance! 😊
It really depends on your use case. For the agenda, are you planning to only display meetings derived from the project milestone dates, or do you also want to manage those meetings (create/update them, store additional information, etc.)?
As for the number of milestones, if they’re strictly tied to the project, you can keep them as they are for now.
The agenda should primarily derive its data from the project list, specifically from the milestone dates associated with the projects. However, it's important for us to maintain the flexibility to edit the agenda directly within the grid. This includes the ability to update existing rows or manually add new rows that may not necessarily be linked to the milestones in the project list.
Would it still make sense to tie the agenda tightly to the project list, or should we decouple it and allow for manual additions while keeping the milestone-based rows synchronized? What would be the best approach to handle both use cases efficiently?
Hey Mihai, do you have no idea - or maybe a hint, how I could implement the saving workflow, or general structure of the application, so that I can solve the problem?
Hi T S,
I remember I have solved the sample once, but some logic is removed due to your backend.
I think you should check how to use DataGrid correctly. Last time I changed the mapping and the structure to let it work.
Hi Shingo,
that was your solution which included the error – anyway, it was the solution I downloaded. I didn't removed anything (on purpose haha)Best regards
So you meant my last oml, u cannot open?
I mean your last oml, yes - i can open it and the functionality i had problems implementing runs, but the error in the saving workflow, i described in this thread also came from your solution
Its weird, I have tested it be4 getting back to u. Let me take a look at your changes
Did you tested it with the agenda - the issues only appears when setting the time slots and auto generate start and end time.
So I tried some things, including changing the saving workflow - especially for test reasons, kicking out the generate times and sort agenda server actions, this would'nt let me solve the problem. For my understanding, the problem is in the DataPrep Server Action mechanism of the Agenda - but I can't figure out, how I can solve the issue, while maintaining the functionality...
The issue is that the database to store MS1, MS2, MS3 as 3 columns in a row.
In the Testgrid screen, its just to simply save all column to db, then it works. In the Agenda screen, its the cooked data to show MSx row by row, but all the other fields are the same, the data grid cannot know which MSx is specified for the current row because the row id is the same. Therefore, the data grid is not applicable for this case to save data dynamically. You MUST use the normal table, but consider that because 1 record is currently shown as 3 rows, whenever you update the general field of 1 row, it will change 3 row at the same time.
Actually, I think you should change your mind about this business flow, users should just be able to change the MSx in agenda, not all the other fields. It makes more sense
But is there no workaround for this? Could we prepare the data directly in OutSystems so that each row has a different row ID? Or would it make more sense to set up another data connection through an API, where the underlying data structure is changed so that every milestone has its own row? Would that be an easier approach, to establish a second data connection and adjust the data structure accordingly?
We would then need functionality in the grid that checks the TestGrid from the list and fills the agenda using the second data structure based on a code or name. Would that be possible to implement?
It follows by your database design, it cannot now. If you wanna strictly handle this by data grid component, I think we need to redesign the database to match MSx together in separate records, linking by the self reference key and MS type. Unfortunately, if the Agenda screen can do it freely by data grid, the TestGrid screen need to cook data on saving to let it work on many records.Is it ok for your use case?
My plan is to create an additional data connection that organizes the different milestone dates in separate rows. This would result in two data inputs: the current one (used for the test grid) and a new one specifically for the agenda. My question is, can we link these two separate data sets in OutSystems? For example, using a code or name as a reference between the two datasets, so that when we add a row in the test grid, we can populate the agenda with the corresponding dates.
Hi T S
Whenever you try to add a new row to the list, the system assigns -1 to its Id, as shown in the screenshot I shared. Because of this, the data is not inserted correctly, since it attempts to save the record with an Id value of -1.
If the Id were NullIdentifier, the record would be inserted successfully.
Please check and confirm whether this is working correctly on your side.
Vijay M.
Its different issue @Vijay Malviya
The TestGrid screen works correctly because the MS1, MS2, MS3 is in the same row, but the Agenda screen cannot save the record correctly because the data is cooked to let MS1 on 1 row, MS2 on 1 row, and MS3 in 1 row