Can anyone advise an example of archive relevant record and not shown in the UI. Thanks.
You have added IsArchive as a locally and you dont have any attribute in your entity to store this value while updating the JobMaintenance.First add a attribute(IsArchive) in your entity so that it can be update directly. I made the changes and attaching OML for your reference.1.)Added a new attribute in the entity.2.)Assigned IsArchive value. 3.)Updated filter, replaced local variable IsArchive to Entity attribute.
Hi Winnie,
Although you provided very little details about the issue. It will great if you can give some more data.
But am assuming there is one list and you want to archive some rows from there. For this you need to give some action on each row. On click of this action you need to mark it as archive in database. For this you can take one column in database of Boolean type lets say IsArchive. By default value will be false, when use archive any record it will be true and you just need to refresh the aggregate after each archive operation. Also in aggregate you can apply filters to fetch only records which are not archived.
regards
Hi @Winnie Lam
Take a look at outsystems documentation on Data Archiving :)
https://success.outsystems.com/documentation/best_practices/architecture/data_archiving/
Regards,
Rúben
Hi Winnie
There are 2 ways to have archived records (in general)
You can keep them in the same table/ entity or create a new table / entity for them. You can decide that based on if you want to use the archived records somewhere in your system.
To keep them in the same table:
Add a boolean to your entity called IsArchived, default false. May be you want to add the ArchiveDateTime to it, to see when the record is archived
When you create your record, it is filled with false, and ArchiveDateTime = nulldatetime()
When you are archiving the record, update this record set IsArchived = TRUE and set ArchiveDateTime with currdatetime()
Be sure that all al the places where you want to select the record, use the filter NOT IsArchived or IsArchived = False
To have another table:
An other way to archive your records, is to remove them from the original table and add them to an archive table. Therefore you create an entity with the same name name, but with the the extension _Archived. So you can have entity Customer and Customer_Archived. Both entities have the same attributes, and the Archived entity has more attributes like ArchiveDateTime and ArchivedBy.
Then you need to make a timer that inserts the records to be archived into the archive table, and delete them from the original table.
In that case, you don't have the make changes to all your aggregates, to exclude the archived records.
Best regards, Marlies
@Marlies Quaadgras @Vikas Sharma
Would please help check my logic, seems my action is not worked. Thank you so much
Hi @Winnie Lam ,Firstly, you are storing the selected records in the different variables and while archiving you are checking the different variables.It should be the same.
Secondly...
In a single checkbox click action you are simply assigning the selected values, but it is not a good approach it will create duplicate records in the list.
On every single click checkbox, you will need to get that specific record and append it to the list.(Or remove the duplicates from the list before archiving)
Checkbox1OnChange and Checkbox2Onchange are related to two entities and their relationship is one jobmaintenance may have many jobdetails, my problem is how should I adjust my logic flow in archiving the data, seems IsArchive is still "False" and not change to "True" when I press archive. Thanks.