16
Views
4
Comments
Solved
I need to keep the history of the changes in a table

Hi buddies, 


I need to keep the history of the changes in a table {ProductCategory}. I created a new table {ProductCategoryHistoric} with the same attributes and added two more attributes: 

[CreatedbBy] of the data type - User Identifier -to store the username of who changed the record. 

[ChangedOn] of the data type - Data Time - to store the current data time of the modification.


In the End-User Module - Back Office - In the ProductDetail screen I have a form for the User introduce the values to populate the {Product Category} Entity.  In the screen action Save I have this:



When I fill the form I created one record in the {Product Category} Entity.

Now my question is where can I fit this with the {ProductCategoryHistoric} Entity because this is what  I want to do: First I create a record of {ProductCategory} and after this, I want to modify the values in the same form and by doing that I want to create a new record in the {ProductCategoryHistoric} Entity with the changes.


Can you help me please?


Thanks in advance.

Best regards,

FC

mvp_badge
MVP
Rank: #75
Solution

Hi Fabio,

A small correction is required...

Syntax for List_Navigation_GetStartIndex function is

List_Navigation_GetStartIndex(ListWidgetId,RememberStartIndex:,StartIndexOverride:)


As per your case, you will have to pass the  List_Navigation_GetStartIndex function first parameter with TableRecord Id value as mentioned below:

List_Navigation_GetStartIndex(ProductCategoryHistoryTable.Id, True)


Hope this helps you!


Kind regards,

Benjith Sam

Rank: #67

Hi Fábio,


If I understood correctly you want to keep a record in historic table for every change made in the ProductCategory table.

I think the best practice here is to create a wrapper that handles the creation / update of a Product Category and that when it does it always creates a record on the historic table.

Look at this example on another project:


In this example, my UI does not need to be concerned with that business logic of having to keep track of history changes, it just makes use of that wrapper provided. This is my UI saving action:


Hope it helps.


Best regards,
João

Hi João,


Thanks for your fast answer!

Helps so much.


I didn't know I could do a Create action with a nullidentifier() in the Id attribute.

I understand the proccess!!!


It's solved and works perfectly!


Best regards,

FC

Hi João,


It is creating the records of the {ProductCategoryHistory} and works perfectly, but now I'm trying to use the rich widget List Navigation but When I switch the navigation doesn't show the next records.


I did the List Navigation like this:





What is wrong with this?


Thank you.

mvp_badge
MVP
Rank: #75
Solution

Hi Fabio,

A small correction is required...

Syntax for List_Navigation_GetStartIndex function is

List_Navigation_GetStartIndex(ListWidgetId,RememberStartIndex:,StartIndexOverride:)


As per your case, you will have to pass the  List_Navigation_GetStartIndex function first parameter with TableRecord Id value as mentioned below:

List_Navigation_GetStartIndex(ProductCategoryHistoryTable.Id, True)


Hope this helps you!


Kind regards,

Benjith Sam