Contains tips for configurators working with Aware IM
#44389 by JonP
Mon Aug 14, 2017 4:23 am
I was looking for an elegant (i.e. lazy) solution for recording changes in a "History" log and I noticed the GET_CHANGES function in the user guide. There is very little explanation and no example of the output. So for what it's worth, here is my experience.

The output is generated as HTML and looks like this (brackets used to generalize the example some):

<div>Created instance [instance #] of [BO]
<table border="1" >
<th>Old value</th>
<th>New value</th>
<td>This should work</td>
<td>This should work now

The table reflects all attributes changed in the BO.

I didn't want the instance/BO stuff at the beginning, so after some trial and error, I was able to remove it using:

Code: Select all[HistoryBO.Attribute]='<div><table '+WORDS_FROM_RIGHT(GET_CHANGES([BO]),WORD_NUMBER(GET_CHANGES([BO]))-5)

I hope that was useful and if you have any suggestions for improvement to my "elegant" solution, please share.

BTW if support sees this, it would be great if you could add a parameter to use the attribute label instead of the attribute name. I realize that this GET_CHANGES function was probably not meant for customers' eyes, but that's the way I want to use it.
#44408 by JonP
Mon Aug 14, 2017 1:30 pm
Here's an example:

<div><table border="1" >
<th>Old value</th>
<th>New value</th>
<td>This should work now</td>
<td>This should work now, really!

I think WORDS_FROM_RIGHT doesn't count returns as a break in the word like it does with a space, which makes HTML in particular a little tricky to parse.
#48407 by rbross
Thu Aug 16, 2018 7:00 pm
Jon, I need to use GET_CHANGES for my customer as well. They also need to see the history of what has been changed.
I did something similar but add the fields I needed to see in the History BO and updated them with the values from the record that is in context. it works but could use a little polishing as well.
#48408 by JonP
Thu Aug 16, 2018 8:09 pm
I eventually gave up on GET_CHANGES. It turned out to be too crude for my taste.
#48409 by rbross
Thu Aug 16, 2018 8:23 pm
What was your solution, to call a process when ever a CRUD was done passing the instance in context and creating a history record of the changes for before and after?
#48420 by JonP
Fri Aug 17, 2018 3:14 pm
I wound up creating a BO_nameHistory BO for every BO where I wanted to capture changes as well as comments. That BO_nameHistory BO has the following attributes: Attribute (which is not a reserved word), Author, Value, WhenAuthored and a relationship attribute to the BO in question. I also have an attribute, pm_Read, for highlighting attributes that have not yet been read, but I don't have that wired-up yet. For changes, I would just add rules to each BO for when an attribute WAS CHANGED.

For comments, I have a non-persisting BO called Comment with attributes, Business_Object and Comment. I then have a process for each BO that looks like this:

Code: Select allENTER NEW Comment WITH Comment.Business_Object='[BO name]' USING Main

where a rule checks Business_Object against a looooong conditional that creates the instance in each History BO.

There's probably a more elegant way to do it.

Who is online

Users browsing this forum: No registered users and 2 guests