Application Studio Select and Update Multiple Rows From Combo

Following this thread How To: Kinetic - Updateable UBAQ in a Grid

I was able to get my uBaq into a grid and update the fields I want by updating them manually. This works, and I can update multiple rows at a time. YAY!

What I actually want is to have the user select multiple rows and update specific fields in the grid based on values selected in pulldown combo boxes.

The DB works in classic but I am having trouble uplifting it. I have a combo box populated by a BAQ, but getting that data into the field I want is proving difficult. I am trying different variations of conditions, row-update, etc. The things I am trying make logical sense to me but I can’t get it right. It may be because I am not a coder but I find it difficult to know when I am meant to use a . or an _ or ’ " {} etc.

My line of thinking is currently assign the chosen options in the pulldowns to CallContextBPMData.Character01, 02, etc and then use a condition to see what rows are selected and then use row-update to update the appropriate fields, then save/update/get.

Ok, so I can get it to update 1 row.

Seems like I need to move my row-update to a separate event and iterate through that.

Looking into that now. :eyes:

Ok it is mostly working now. The last field I want to update is a kind of timestamp/unique code.

In my old uBAQ I was using BpmFunc.Now() .ToString(“MMddyyHHmmss”)

But it doesn’t seem to be working here. Do I need to use different syntax or am I not plugging it into the row-update correctly.

Argh.

This should do the job for your row update.

'#_((d => [String(d.getMonth()+1).padStart(2,'0'),String(d.getDate()).padStart(2,'0'),String(d.getFullYear()).slice(-2),String(d.getHours()).padStart(2,'0'),String(d.getMinutes()).padStart(2,'0'),String(d.getSeconds()).padStart(2,'0')].join(''))(new Date()))_#'

(Generates a string of text 090425134027 for now (09/04/2025 13:40:27)

To explain, the syntax is Javascript, wrapping the whole thing in ’ single quotes ’ tells AppStudio to treat the stuff inside as a string of text, #_ _# tells App Studio to run the JavaScript Eval() function on the code inside, which executes it.
The code instantiates a new variable “d” with “new Date()” which is equivalent to DateTime.Now/BpmFunc.Now() representing todays date/time, and then builds the desired output string by breaking down each component of the date into it’s month,day,year,hour,minute,second bits, then converting those bits to strings of the desired format (padding with a preceding 0 as applicable), and globbing all the strings together into a kaiju-string. (I think the technical word is concatenating strings? pish posh)

2 Likes