Pass a dataview to a function for further processing

Gotcha. Thanks for the response. Do you know if there is a better way to access the data from the view other than this #_JSON.stringify(trans.dataView('SpecialItemsView').viewData)_# ? I am using this in other places. For instance I am assigning the data in the SpecialItemsView to the text box “Result”. I am also putting this in the erp-function->Method Parameters->Field Value to be passed to the function as a parameter type “String”. If I CTRL+ALT+V ,in dev tools, and expand my SpecialItemsView I see the column “Name” and the rows.

c

1 Like

Why not just bind the dataset returned from the function and then bind your result textbox to SpecialItemsView.Column name?

2 Likes

I think that would give me the individual value per row. I am needing a list/array of the contents of the grid. Ex. [{Name:"one"},{Name:"two"},{Name:"three"},{Name:"four"}]. I can then shape it, if needed, to something like one~two~three~four or whatever. Can I bind to the viewData not just one column?

Not really.
If you’re looking for aggregate data like that, I would build the string in your function and return that aggregate string instead of a dataset.

What exactly is it you’re trying to accomplish in the end?

1 Like

I am working on a product configurator we are starting to build. We are storing “non-standard” items( items not in a predefined list or combo box) in a grid view that we can use when building our “bill of materials”. I am going to set the value of a text box to be a list of “Special Items” that we may or may not need to order. I like your idea of returning a string from my function for the text box. I could actually return both in 2 separate response parameters. One dataset to populate the grid the other formatted for a string like this one~two~three~four. I suppose I need to continue to use #_JSON.stringify(trans.dataView('SpecialItemsView').viewData)_# to get the data from the view to pass as a parameter to the function?

Toooottttally glossed over that you’re SENDING the dataset to the function. Stand by.

2 Likes

Okay–I wasn’t able to get it working with the erp-function widget, but I did get it working with the rest-erp widget.

image

6 Likes

Thanks for taking time to help. I am about to leave work so I will try this on Monday. By the way is the difference between erp-function and rest-erp the payload you send from the client?

1 Like

The difference is the function widget can only do functions.
The rest widget can make any BO call.
I’m pretty certain the function widget is just a dumbed down version of the rest one.

2 Likes

I can’t wait to have an environment to try all of your tips and tricks and how-to demos in @hmwillett

Hopefully will be installed in the next month!

1 Like

@hmwillett how can we send data or rows or selected row from a custom panel card grid to the function??

I would try using the row-copy widget and copy the current row to a new dataset and send that whole dataset containing the single row to your function.

This is fantastic Hanna - thank you!

1 Like

Hello Hannah,

I tried the same steps but I am getting one issue. If I select MethodModifier to all rows. I am getting data in payload but with an error.

This is the error:

This is the new data view holding the rows I want to send to Kinetic functions:

What’s the actual error?

How is your function processing the dataset you sent it?

1 Like

Hello Hannah,
I think it working as expected what I find the problem is using BO delete method to delete the list of pricelists per supplier.

I tried using BPM and use VendPart BO and the method DeleteByID but that too didn’t work. Not sure whether there is a bug or something.

This is the error I am getting everywhere: Kinetic Debugging, Rest help as well as BPM. Have you gone through this before? If yes, can you guide what else can I try to do?

image

You’ll have to look at the Event Viewer on the server for the specific error when it gives you a message like that.

If you are trying to delete, many times if this is from a set of data the enumeration will get messed up when deleting front to back instead of back to front.

1 Like

RE: how can we send data or rows or selected row from a custom panel card grid to the function??

Know this an old thread , but helpful info for those looking to do this, found a way to send Selected Grid Row Field data to function with the following:

  • Use the Copy View instructions posted under write up titled “How To: Kinetic - Working with Grid Selectors”, in the associated ce_ADDRow iterate event, after the row-add component, added a ERP-Function component which passed the current CopyView row field to my function as a method parameter. It’s the little things … Cheers

Using ERP-FUNCTION in the Kinetic client, I was able to pass a dataset (view) from the Kinetic client to a function. In the ERP-FUNCTION, set the Method Parameter ‘Field Data Type’ to dataset, and set ‘Dataset Id’ to the view name, such as UD25View. In the server side function, set the Request Parameter type to System.Data.DataSet. It works.