How To: Adding Columns to Existing Kinetic Grid

Troubleshooting comment to be aware of: How To: Adding Columns to Existing Kinetic Grid - #52 by hmwillett

This one was interesting to get going.
Thanks @askulte for the challenge and thanks @Ishkaran for the slight tweaks to get this polished.

This “How To” segment is going to cover how to add one or more columns to an existing Kinetic grid/view.
Note, that this initial method iterates through each line of the view to populate the columns and likely isn’t the most efficient, but I will update this post as I find more methods that work.
For this example, I’m adding Part.RunOut and Part.TypeCode to the Quote Lines panel card.

*** Check out “Version 2” for a faster, more efficient iteration. ***

  1. Step one is to add your related columns to the native DataView.

  1. Create a View to hold the rows from the REST call you will make. If you’re calling a standard BO, then then the columns will come in automatically when you define the Data Table. I entered “Part”, so all of the columns in Part came in for me. If this is a more custom table, then you will have to add the columns yourself.

  1. Next, create a new event that’s going to iterate through the rows. This event will have no trigger and a single “DataView-Condition” widget.

  1. Configure the DataView-Condition as follows:

image

  • Dataview: This is the view that you’re looking to update.
  • Result: this should be “matches” which is a system DataView to hold the rows of any match based on the expression.
  • Expression: Add some logic here. I used QuoteDtl.Quoteline <> 999 in order to grab every row in QuoteDtl. I’m sure there’s another way to do this, but this worked well enough.
  • Iterative Event: This is the name of the event that holds the actions we want to do each time we iterate through. Enter the name of the event you create in step 5.
  1. Create a new, no trigger event for your iterations.

  1. Configure it as follows (adjust to your needs):
  • Add a “rest-erp” widget and configure it to the BO that fits your needs. My example is getting part data.

GetByID also works for this.
image

For the field value in the method params, you’re using the result from the rows contained within matches. In other words, only the rows that matched the condition we specified earlier.
image

Parameter Name: This is the table element returned JSON.
View Name: This is the view you’re binding the results to.
Parse from Response Path: as far as I know, this will always be “returnObj” unless it’s a custom REST call.

  • On the rest widget, choose the On Success behavior and select a condition widget (*Note, I have a console-write in between mine for debugging purposes. You can ignore that)
  • For the condition widget, set the expression to check if your data view is undefined.

  • Off of the TRUE branch of the condition, select “Row-Update”. This is where you’re going to set the values in the grid.

Ep Binding: set this to matches.YourColumnName. Whatever is populated in the “matches” table will be merged with the View you defined in your dataview-condition (QuoteDtl).
Value: set this to grab the value from the view your REST widget populated.

  • Off of the FALSE branch, do something so that the processing can keeping going for other events. Originally, I did not set this to anything and it didn’t behave properly. I have it set to write “FALSE” to the console.
  1. Finally, find the AfterGetByID event. At the end of the predefined actions, add an “Event-Next” widget and set the Event ID to the event you created containing the DataView-Condition.
    This has changed in later versions and native events are locked. The change to this is to create your own event, set the Type to “Event”, the Hook to “After”, and the Target to be “AfterGetByID” (or whatever suits your needs in that particular form. You may have to do a trace with Dev Tools. Then add an “Event-Next” widget and set the Event ID to the event you created containing the DataView-Condition.

Save and test 'er out!

AddColumnsToViews

You can see that it 's populating line-by-line which is not the greatest solution if you have hundreds of lines. It’s feasible to create a BAQ View (like days of old), but you would have to modify a lot of events to make sure it’s pointing to the new view.

** Note, if you’re following my example, you will have to wire an event to the TransView.ShowKitDetails ColumnChanged event.

12 Likes

Yeah! Thanks @hmwillett!!!

1 Like

Version 2

This version is slightly more efficient.
It uses a BAQ to grab all the relevant records in the quote and populate the BAQ View at once instead of doing REST calls every iteration.

  1. Create a BAQ that contains the Primary Key of the native grid and the fields you want to add from the associated table.

  1. Create a view to hold your BAQ information.

  1. Add your new columns to the native View (QuoteDtl).

  1. Create a “No Trigger” event that’s going to start with an “erp-baq” call.

  1. Configure the “erp-baq” widget to call your BAQ and filter it based on your primary key (QuoteNum)

image

This allows you to have all of the information available at the get-go instead of having to get it each time.

  1. Add a condition to make sure something came back.

image

  1. Off of the TRUE node, set up a “dataview-condition” just like the original post. For details, see the first post in this thread.

  1. Create an iteration event and wire the “No Trigger” to a “dataview-filter-set”. The idea behind this is you’re going to filter the BAQView to only the row you need for each iteration.

  1. Then, do a “row-update” and set the row in the “matches” view to the corresponding row in the BAQView that you filtered.

  1. Lastly, wire up the “AfterGetByID” event to your initial population event.

Much faster!

12 Likes

Stay tuned for a full BAQ View replacement of the original View.

Trying to follow the example to add a column to TimePhase grid
I am stuck on the row update of the Iterate event - I don’t see a ‘epiBinding’ field :frowning:


I am sure I messed something up along the way - any ideas?

What version are you on?

2021.1.8

Hmm.

Two things to try:

  1. Save, exit, go back in
  2. Try it in the browser (that’s where I do my dev)

sadly the same results obtained when logging in using browser

I’d log a support ticket.

I am using another dev server with .4 on it and I was able to see the ‘epiBinding’ - so now I am troubleshooting and see this error in the browser debugging console: unable to find matches dataview

nevermind - somehow the first event was changed to be the same as the second event :frowning:
I recreated it and the matches dataview is created now

1 Like

I exited the browser to clear the debugging console and went back in to Kinetic
I opened application Studio and opened the Layer I was working on. The epiBinding does not show in Row-Update widget now :angry:
I deleted the Epicor folder in Program data and in my user appdata local and roaming folders with no change

This just seems not ready for prime time yet - a simple couple line mod in the classic UI should not be this difficult

Have you tried a different browser? I’ve been using MS Edge with good results.

Edge, Chrome and Epicor Interface – no difference

How about clearing the browser cache, though I can’t see that making a difference if the smart client doesn’t work, but it’s worth a shot?

Did that also

Have you tried deleting the row-update widget and adding it back?
What about a new layer?
What about a new layer on a different screen?

I just Published the layer (even though it isn’t working) added it to the menu, opened from the menu and then opened Application Studio and the row-update widget has the EpiBinding box again

Wild. Definitely submit that to support if you can replicate it consistently.