How To: Kinetic - Updateable UBAQ in a Grid

Ope hey der. It’s me! Jessica!

Haven’t done one of these in a while and a good topic came up from another thread that I figured I’d make a more official post on.

How in the heck do you wire up a UBAQ to a grid in Kinetic and, you know, actually make it update?!

Drum Roooooolllllllll

You gotta work for it. Boooo. :slight_smile:

  1. This step is hopefully obvious, but go build your UBAQ. I’m not gonna get into that, there are plenty of posts on how to do so. Work yer Google-Fu on EpiUsers.
  2. Open up Application Studio on the form you want to add the grid to.
  3. Create a DataView to hold the BAQ information for the update

  1. Throw a panel card grid to your work surface (you can also use a regular grid).

  1. Go to the Properties of your new panel grid and go to the Grid Model property and make it editable.

  1. Add your columns from your UBAQ.

  1. Make the column you want to update… well… updateable!

  1. Go to the Grid Model > Provider Model property and set the view you created in step #3 and enter your BAQ ID

  1. Go back to the top level properties of your grid and go down to Action Data.

  1. Add a new Tool for Save. Give it an ID for use later, a description (what will be shown to the user when they hover, an icon (optional), and add it to the primary toolbar (optional).
    You can find the icons here: Material Design Icons (pictogrammers.github.io) Use whatever you want, just make sure that it’s in the format of “mdi + icon name”. For example, the icon’s name that I used was “mdi-ghost”, so I would enter mdi mdi-ghost

  1. Create a new event and make the Trigger be Control > On Click > Your tool ID from Step #10

>>> Click here if you’re on a version below 2022.2 for steps 12 and 13 <<<

  1. Call the erp-baq widget and wire it up for an update and attach the view you created to it.


image

  1. Lastly, throw on another erp-baq for the grid refresh.

Voila!

Context with my UBAQ: I just made a simple UBAQ where I can update the TypeCode. It will only show the top 10 purchased parts, so you can see that when I change the top to to manufactured and save it, they drop off after the refresh.
UBAQ_Kinetic2

22 Likes

Hmm, everything was going well until the erp-baq widget. I don’t have the same options on mine that you display above. Any idea why? I’m on version 11.2.100.12

Go into the BAQ Execute Options. Setting update there should probably do.

This was done on 2022.2.2.

I don’t see where I’d do that.

Oh, interesting!
Let me hop on an older system and take a look.

1 Like

Okay, some modifications for 2021.2.X for steps 12 and 13.

  1. Call the rest-erp widget and wire it up as follows:

image

Add the name of the view you created in step 3.
image

Parameter Path must be queryResultDataset
Parameter Name must be Results
View Name is the view you created in Step 3

Add the name of your view from Step 3 in Dataset Id and Server Dataset Id
image

  1. Add an erp-baq widget for the refresh.

image

That should do it for anyone under 2022.2.

3 Likes

@hmwillett In step 6, you’re adding columns from your BAQ, but it doesn’t look like you bind your grid to the dataview or BAQ until step 9. How do you properly add the columns you want to see? And is there a difference if you when adding them under Grid Model > Columns or Grid Model > Provider Model > Columns?

I always seem to have an issue creating columns for BAQ Dataviews. If I do nothing under the columns it will return everything from the BAQ, but the column headings are ugly. I can’t seem to find the right location and format to add individual columns.

Think I answered my own Question

Add Columns using Grid Model > Columns (like your step 6 screenshot) and be sure not to do anything in Gird Model > Provider Model > Columns.

Just need to Add New and provide Field (Name of BAQ/Dataview Field Only) and Title values.

BIG IMPORTANT You need to save and exit your custom layer before these changes fully take effect. If you go directly to preview, data does not load. Upon re-opening the kinetic custom layer everything was all good.

BIG IMPORTANT #2 If you’re BAQ Dataview is utilizing a Parent/Child Relationship. All of the relationship fields must be added to your columns

2 Likes

Thanks Hannah! This worked great. My mistake when running though this is I didn’t include all my columns and I only added the columns I wanted to display. This meant I missed my key fields that were needed by the BAQ update.

1 Like

image
Does anyone know how the image above managed to put the button icon in, I want to do the same thing with my custom Grid.

So what your really asking is how do you add a control to a cell in a grid.

This is the closest I could find… But in your instance you would use a button then add the icon to that from here Material Design Icons a recent post from

here is another link that talks about adding icons.

I did try to have a crack at this myself, but to no avail…

Funnily when I try to look at the attachments slider on forms in AppStudio I can;t find them… @hmwillett am I just going blind?

1 Like

Thank you for your reply. I know what you said about adding controls to Primary, but I want to put button controls in the ToolBar in Grid :grin:

In the example shown there was a combo box on the grid. I understand you want to puta a button that will fire an action similar to the attachments slider




I tried to edit this property,But I clicked no way to start the event

1 Like

@hmwillett Thanks for this awesome writeup, it helped me get started.

I had previously had a grid setup with a BAQ in a new slider, but I found I did not need a dataview (or the baq-update and baq-get steps in the event).

So I was using this post to switch the grid over to use what is now an Updatable BAQ.

I created the dataview, baq schema, and specified my new baq,
Also put the view id in the Provider Model EpBinging setting.

The problem I am hitting now, is when it hits the baq-update in the event (assuming I have rows modified), I get this error:

image

and the network response for the query shows:

image

My updatable query is primarily QuoteDtl fields and the required key fields from QuoteHed.

When I do an update using the BAQ designer, I do not get the error

Any thoughts ?

thanks, Scott

I did figure out my sql error, got access to server logs (cloud/saas customer)…
stupid typo on one of column names…QuoteHed.QuoteNum instead of QuoteHed_QuoteNum…doh

2 Likes

Is there a similar post somewhere to do this on a Classic form? I need an updatable grid showing UD records related to a Part that is selected, and an edit form to make entry of new records outside the grid possible. I can make a dashboard that is updateable using the wizard, but I can’t show a single record in fields like you could in a tracker view.

@hmwillett
In classic dashboards, when a row was being updated, both the old (rowmod = “”) and updated (rowmod = “U”) were sent to the update method of the BAQ.

For an old classic dashboard I used an updatable BAQ directive in which I checked which field was being changed by comparing the old and updated row with eachother.

This UBAQ Directive is no longer working in a Kinetic dashboard, since only the updated row is being sent to the Update method.

Is there any way to send both the old and updated row to the update method?

My UBAQ Directive code looks like this:

var updRow = (from row in queryResultDataset.Results
           where row.RowMod == IceRow.ROWSTATE_UPDATED
           select row).FirstOrDefault();
           
if(updRow != null)
{
    var oldRow = (from row in queryResultDataset.Results
                 where row.SysRowID == updRow.SysRowID
                 && row.RowMod == string.Empty
                 select row).FirstOrDefault();
                 
    if(oldRow != null)
    {
        for(int i = 0; i < updRow.Table.Columns.Count; i++)
        { 
            if(!new string[] {"RowMod", "SysRowID", "RowIdent"}.Contains(updRow.Table.Columns[i].ColumnName))
            {
                if(Convert.ToString(updRow[i]) != Convert.ToString(oldRow[i]))
                {
                    // do stuff
                }
            }
        }
    }
}
2 Likes

If this is true, we need to complain. This is base functionality that should be present,

I was going to say the uBAQ works the same as ours are working fine in Classic and Kinetic. We however don’t evaluate the old row in ours thus we wouldn’t catch it. Please let support see it as the :beetle: it is.