uBAQ get the before update values

Hi! This is embarrasing but I can’t find a simple solution. I am using a updateable BAQ in dashboard and was later required to set funcitonality to keep track of the changes in a date field. I know I can activate the change log, however in this case the changes are only to be tracked on one field and there shouldn’t be much changes. So I am required to show in the same uBAQ the “log” in another column concatenated.

Sure thing, this isn’t an issue, just creating a pre directive on the update baq can keep track of this and save the log field every time that date changes.

However(and this is the embarrassing part) I can’t find the original value in any of the bpm directives, so I can’t save the last date in the log. I tried on the fieldupdate, fieldvalidate, update, etc. But even on those methods, i just get an empty value.

I suppose I could set a simple getlist or getID on the object to obtain the orginal data again before updating, but it seems way too much work for something that simple. I even tried a “clever” trick, setting default/initial value for another date field to the tracked one, but it is glitchy and I am sure I am missing something . Could you shine a light onto me?

Thanks!

If the data is already in the database, why aren’t you just getting the data from the BAQ? You’ll need to explain more detail what you are doing here.

1 Like

Pre on update should get you the original rows.

var originalRows = queryResultDataset.Results.Where(x => String.IsNullOrEmpty(x.RowMod));

If client sends them :smiling_imp:

1 Like

He showed classic, so I assumed that bullshit wasn’t a problem.

1 Like

He shows classic BAQ, not where it is used.

1 Like

Getting them from DB is much better than relying on something sent from client that can be easily changed

1 Like

You are right, Brandon, that particular field is being updated in the uBAQ. That is, the date is modified, then updated in the same process. I am simply trying to save what the previous date value was along with the new one in a string indicating the change. This is used in a dashboard, where all the documents are available for update(meaning it is a simple grid to update those values)

Sorry for the image, column names are in Spanish.

So, if the user updates that date field on the dashboard, the row character07 field gets populated with the new date and a timestamp of when that happened. What I am trying to retrieve is the previous value that was in that date field.
In the bpm I am simply using the widget to set field, and the expression concatenates what is already in character07 add a pipe charecter, the timestamp and the new date. I am trying to also add the previous date before the update in this “log”.

mmm I am using the set field widget, so I don’t believe that I can place that in the expression. I guess I can use a custom code widget and do that, although not sure the queryResultDataset still has the complete rows in this case. I can get the database original in the custom code widget also, but I thought I was overcomplicating it and that the original value was still there somewhere to be grabed. I was expecting to grab it from a pre on field validated and put it on a callcontext variable, and then use it on the pre update expression. But I can’t seem to find that value in those methods.

Why aren’t you just adding the new timestamp to the end of the existing field?

You can return the log value,

Date1

Then in the update

Date1+Date2

You can make a calculated field to hold the new date stamp until you can get to the update to concentrate it onto the log field of you need to. (I don’t know how you’re doing the update, so I don’t know if you would need that)

Certainly, I was expecting to avoid going to the database again for each update the user does in the grid. There shouldnt be more than 20-30 records updated at the time, but still I was trying to “save” those runs to the database.

1 Like

The records should be there to pull from.

The new UI seems to not be sending them. The jury is still out on whether that is supposedly a :beetle: or a feature.

mmm I tried that if I understood correctly, the “clever” trick, using another date field to automatically set its initial value to the same value that was in my date field. But it was glitchy, didn’t try it with a calculated field, maybe that will work way better, since it won’t be saved into the database and will be cleared/set every time.
Will try that, thank you!

I will see then, haha
Thanks!

Yep, still had the issue I had saving to a date field before, but it was way simple to just update the calculated field again in the same bpm pre update directive and the result is there. As Olga said, if the user “plays” with the data of the same records multiple times it might get junk, but that shouldn’t be the case. Love to depend on the user acting rational. Haha, thanks again all!